1 | initial version |
like i thought:
return cv::Mat(img.height(), img.width(),format, img.bits(), img.bytesPerLine());
you're taking a shallow copy of the data pointer here, it will be invalid, once you leave that callback function.
add a clone()
as in:
return cv::Mat(img.height(), img.width(),format, img.bits(), img.bytesPerLine()).clone();
2 | No.2 Revision |
like i thought: the problem is here:
return cv::Mat(img.height(), img.width(),format, img.bits(), img.bytesPerLine());
you're taking a shallow copy of the data pointer (img.bits()) here, it will be invalid, once you leave that callback function.
add a clone()
as in:
return cv::Mat(img.height(), img.width(),format, img.bits(), img.bytesPerLine()).clone();
3 | No.3 Revision |
the problem is here:
return cv::Mat(img.height(), img.width(),format, img.bits(), img.bytesPerLine());
you're taking a shallow copy of the data pointer (img.bits()) here, it will be invalid, once you leave that callback function.
remedy: add a clone()
as in:
return cv::Mat(img.height(), img.width(),format, img.bits(), img.bytesPerLine()).clone();