Открыть резюме: утверждение не удалось при реализации SIFT

Я пытаюсь реализовать SIFT в студии 2013 и OpenCV 2.4. И я получаю следующую ошибку.

OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channels()) && ((((sizeof(size_t)<<28)|0x8442211)

((DataType<_Tp>::depth) & ((1 << 3) - 1))*4) & 15) == elemSize1()) in unknown function, file C:\opencv231\build\include\opencv2/core/mat.hpp, line 552

Я думаю, что ошибка в этом коде:

    void FindMaxMin()
{

cout << endl << "IN findmaxmin  " << endl;
int i;
int j;
int xiter, yiter;
for (i = 0; i < 4; i++)
{
for (j = 1; j < 3; j++)
{
middle = LOG_img[i][j];
up = LOG_img[i][j - 1];
down = LOG_img[i][j + 1];

for (yiter = 1; yiter < middle.rows-1; yiter++)
{
for (xiter = 1; xiter < middle.cols-1; xiter++)
{
cout << i << "  " << j << "  " << yiter << "  " << xiter<< "  "<<endl;
double currentPixel = middle.at<uchar>(yiter, xiter);
cout << "1 ";
// Check for a maximum
if (currentPixel> middle.at<uchar>(yiter, xiter + 1) &&
currentPixel> middle.at<uchar>(yiter, xiter - 1) &&
currentPixel > middle.at<uchar>(yiter + 1, xiter) &&
currentPixel > middle.at<uchar>(yiter + 1, xiter - 1) &&
currentPixel > middle.at<uchar>(yiter, xiter + 1) &&
currentPixel > middle.at<uchar>(yiter - 1, xiter) &&
currentPixel > middle.at<uchar>(yiter - 1, xiter + 1) &&
currentPixel > middle.at<uchar>(yiter - 1, xiter - 1) &&

currentPixel > up.at<uchar>(yiter, xiter) &&
currentPixel > up.at<uchar>(yiter, xiter + 1) &&
currentPixel > up.at<uchar>(yiter, xiter - 1) &&
currentPixel > up.at<uchar>(yiter + 1, xiter) &&
currentPixel > up.at<uchar>(yiter + 1, xiter - 1) &&
currentPixel > up.at<uchar>(yiter, xiter + 1) &&
currentPixel > up.at<uchar>(yiter - 1, xiter) &&
currentPixel > up.at<uchar>(yiter - 1, xiter + 1) &&
currentPixel > up.at<uchar>(yiter - 1, xiter - 1) &&

currentPixel > down.at<uchar>(yiter, xiter) &&
currentPixel > down.at<uchar>(yiter, xiter + 1) &&
currentPixel > down.at<uchar>(yiter, xiter - 1) &&
currentPixel > down.at<uchar>(yiter + 1, xiter) &&
currentPixel > down.at<uchar>(yiter + 1, xiter - 1) &&
currentPixel > down.at<uchar>(yiter, xiter + 1) &&
currentPixel > down.at<uchar>(yiter - 1, xiter) &&
currentPixel > down.at<uchar>(yiter - 1, xiter + 1) &&
currentPixel > down.at<uchar>(yiter - 1, xiter - 1)
)
{
cout << "inside, updating extrema  ";
Extrema[i][j - 1].at<uchar>(xiter, yiter) = 255;
}

else if (currentPixel< middle.at<uchar>(yiter, xiter + 1) &&
currentPixel< middle.at<uchar>(yiter, xiter - 1) &&
currentPixel < middle.at<uchar>(yiter + 1, xiter) &&
currentPixel < middle.at<uchar>(yiter + 1, xiter - 1) &&
currentPixel < middle.at<uchar>(yiter, xiter + 1) &&
currentPixel < middle.at<uchar>(yiter - 1, xiter) &&
currentPixel < middle.at<uchar>(yiter - 1, xiter + 1) &&
currentPixel < middle.at<uchar>(yiter - 1, xiter - 1) &&

currentPixel < up.at<uchar>(yiter, xiter) &&
currentPixel < up.at<uchar>(yiter, xiter + 1) &&
currentPixel < up.at<uchar>(yiter, xiter - 1) &&
currentPixel < up.at<uchar>(yiter + 1, xiter) &&
currentPixel < up.at<uchar>(yiter + 1, xiter - 1) &&
currentPixel < up.at<uchar>(yiter, xiter + 1) &&
currentPixel < up.at<uchar>(yiter - 1, xiter) &&
currentPixel < up.at<uchar>(yiter - 1, xiter + 1) &&
currentPixel < up.at<uchar>(yiter - 1, xiter - 1) &&

currentPixel < down.at<uchar>(yiter, xiter) &&
currentPixel < down.at<uchar>(yiter, xiter + 1) &&
currentPixel < down.at<uchar>(yiter, xiter - 1) &&
currentPixel < down.at<uchar>(yiter + 1, xiter) &&
currentPixel < down.at<uchar>(yiter + 1, xiter - 1) &&
currentPixel < down.at<uchar>(yiter, xiter + 1) &&
currentPixel < down.at<uchar>(yiter - 1, xiter) &&
currentPixel < down.at<uchar>(yiter - 1, xiter + 1) &&
currentPixel < down.at<uchar>(yiter - 1, xiter - 1)
)
{
Extrema[i][j - 1].at<uchar>(xiter, yiter) = 255;
}

else
Extrema[i][j - 1].at<uchar>(xiter, yiter) = 0;
}}
}
}
}

Код печатный «IN findmaxmin» 0 1 1 1
и тогда происходит ошибка. Я проверил оставшийся код, закомментировав эту функцию, и код работает нормально.

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]