当我试图从原始图像创建ROI时,我得到了以下错误。我理解错误的含义(我的意思是,我理解原因)。--但是我不明白,我的代码的哪一行给了我这个错误?在我的整个代码中有几个地方我可以从原始框架中创建ROI。
错误:
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 /tmp/buildd/ros-hydro-opencv2-2.4.6-3precise-20140130-1854/modules/core/src/matrix.cpp, line 323
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/buildd/ros-hydro-opencv2-2.4.6-3precise-20140130-1854/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发布于 2014-02-18 19:54:50
无法知道异常正在抛出的代码行,除非您做了一些查找它的操作,例如:
从使用ROIs的经验来看,很可能您正在尝试在某个地方使用ROI对图像进行子集,并且您正在超出界限。或者您的ROI大小为0,0。
发布于 2014-02-18 19:39:08
在调试器中运行您的代码,查看失败的地方,或者检查堆栈跟踪,以查看从哪个函数调用的函数。
或者,如果你不能做到这一点,在每个roi呼叫前面放置一个printf("ok1");等。
https://stackoverflow.com/questions/21863613
复制相似问题