项目开发中使用到opencv,设置roi区域。运行时出现了tombstone。
Abort message: 'terminating with uncaught exception of type cv::Exception: external/opencv3/modules/core/src/matrix.cpp:495: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols &0 <= roi.height && roi.y + roi.height <= m.rows in function Mat
分析发现,原因是图像的ROI区域超过了图像的尺寸,即roi.x + roi.width > m.cols && roi.y + roi.height > m.rows;
之前一直以为从camera得到的图片是1920 * 1080的,而添加打印后发现,实际大小只有1080 * 720;所以出现了这个问题;
重新调整ROI区域的设置,运行时就正常了。
Mat src = imread("path_to_image");
cout << src.width;
cout << "Width : " << src.cols << endl;
cout << "Height: " << src.rows << endl;
问题
原因:
You are probably work
ing
outside of the image dimensions. Does any of the values you pass to the cvSetImage
ROI
function lay outside the image boudaries?
图像的
ROI
区域超过了图像的尺寸,即
roi
.x +
roi
.width >...
# Read images : src image will be cloned into dst
obj= cv2.imread("src.jpg")
im = cv2.imread("dst.jpg")
# Crea
te
an all whi
te
mask
mask = 255 * np.ones(obj.shape, im.dtype)
# The location of the cen
te
r of
1.
Nat
ive代码的crasharm64.txt崩溃信息
2020-12-09 09:00:07.370 30885-30885/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-12-09 09:00:07.370 30885-30885/? A/DEBUG: Build f
ing
erprint: 'vivo/PD1911/PD1911:10/QP1A.190711.020/compiler
CSDN-Ada助手: