小编Die*_*yes的帖子

OpenCV ROI出错

我正在尝试制作一个程序,通过在图像上滑动ROI并将ROI与模板进行比较来识别模式,它将比较ROI和模板的像素值,并在每次像素匹配时将计数器增加1,然后我将计数器与阈值进行比较,如果它通过一个矩形将被绘制,如果没有,它将继续滑动通过图像,如果我在其上运行调试器,它显示没有错误滑动通过图像,但如果我正常运行它会抛出下一个异常:

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 Mat, file /home/abuild/rpmbuild/BUILD/opencv-2.4.6.1/modules/core/src/matrix.cpp, line 323
terminate called after throwing an instance of 'cv::Exception'
what():  /home/abuild/rpmbuild/BUILD/opencv-2.4.6.1/modules/core/src/matrix.cpp:323: error: (-215) 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 function Mat …
Run Code Online (Sandbox Code Playgroud)

c++ opencv

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

opencv ×1