我需要使用C ++在OpenCV中找到图像边界框的边界。使用double perimeter = arcLength(rois[wp],true);
时会生成以下错误:
Assertion failed (count >= 0 && (depth == CV_32F || depth == CV_32S)) in arcLength,
file /home/vidushi/Desktop/OpenCV/modules/imgproc/src/shapedescr.cpp,
line 285 terminate called after throwing an instance of 'cv::Exception'
what(): /home/vidushi/Desktop/OpenCV/modules/imgproc/src/shapedescr.cpp:285:
error: (-215) count >= 0 && (depth == CV_32F || depth == CV_32S) in function arcLength
有人可以解释可能出现的问题吗?
答案 0 :(得分:1)
基本上rois[wp]
函数不接受arcLength
的格式。它必须是2D并且具有CV_32S或CV_32F深度。像cv::Mat valid_roi(n, 2, CV_32F);
这样的东西(适应你的问题)。