Error:
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat, file C:\build\master_winpack-build-win64-vc14\opencv\modules\core\src\matrix.cpp, line 522
出错函数:
cv::Mat imageROI;
imageROI = image(cv::Rect(10,10,logo.cols,logo.rows));
问题原因:
图像的ROI区域超过了图像的尺寸,即roi.x + roi.width > m.cols && roi.y + roi.height > m.rows
解决方法:
1:检查自己imread 的图像的像素是x*y,然后imageROI的范围是否大于了x或者y,然后调整图像的尺寸
2:学习一下imageROI这个函数
https://www.cnblogs.com/farewell-farewell/p/5905107.html