I am getting an assertion failed error in line 537 of Mat::at
OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)si ze.p[0] && (unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channel s()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3 ) - 1))*4) & 15) == elemSize1()) in unknown function, file c:\users\tim\document s\code\opencv\build\include\opencv2\core\mat.hpp, line 537
I am trying to populate matrices that I will use in the function cv::remap. The part of the code that is causing this failed assertion is below:
void Functions::PopulatedMapY(Mat image)
{
mapy.create(image.rows, image.cols, CV_32FC1);
for (int j = 0; j<image.rows; j++)
{
float a = (image.rows - 1) - gazey;
float b = (image.cols - 1) - gazex;
for (int i = 0; i<image.cols; i++)
{
mapy.at<float>(j,i) = map2y.at<float>(a+j,b+i);
}
}
}
The matrix map2y was defined in the MapCreator Function as follows:
void Functions::MapCreator(Mat image, float const_a, float const_b)
{
map2x.create(2*image.rows, 2*image.cols, CV_32FC1);
map2y.create(2*image.rows, 2*image.cols, CV_32FC1);
for (int m = 0; m<2*image.rows; m++)
{
ty = image.rows - m;
for (int n = 0; n<2*image.cols; n++)
{
tx = image.cols - n;
map2x.at<float>(m,n) = n;
map2y.at<float>(m,n) = m +const_b*exp(-pow(tx,2)/pow(const_a, 2))*Signum(ty);
}
}
}
Any help would be much appreciated!