Hey guys,
I´m currently working on an implementation to use opencv stitching lib for video stitching.
Now I´m facing the problem that as soon as I try to feed the blender with data, an assertion fails with the following message.
“OpenCV(4.9.0) Error: Assertion failed (y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0])) in cv::Mat::ptr, file D:\Repos\opencv\modules\core\include\opencv2/core/mat.inl.hpp, line 715”
In this peace of code:
void Blender::feed(InputArray _img, InputArray _mask, Point tl)
{
Mat img = _img.getMat();
Mat mask = _mask.getMat();
Mat dst = dst_.getMat(ACCESS_RW);
Mat dst_mask = dst_mask_.getMat(ACCESS_RW);
CV_Assert(img.type() == CV_16SC3);
CV_Assert(mask.type() == CV_8U);
int dx = tl.x - dst_roi_.x;
int dy = tl.y - dst_roi_.y;
for (int y = 0; y < img.rows; ++y)
{
const Point3_<short> *src_row = img.ptr<Point3_<short> >(y);
--> Point3_<short> *dst_row = dst.ptr<Point3_<short> >(dy + y); //Here is the fail!
const uchar *mask_row = mask.ptr<uchar>(y);
uchar *dst_mask_row = dst_mask.ptr<uchar>(dy + y);
for (int x = 0; x < img.cols; ++x)
{
if (mask_row[x])
dst_row[dx + x] = src_row[x];
dst_mask_row[dx + x] |= mask_row[x];
}
}
}
y = 0 and dy = -110.
It looks like the assert fails because the data field is data=""
. But when I go back in the Callstack it looks like there is Data in cv::Mat.
Please if someone could help me.
Thanks
Best regards
Pascal