由BackgroundSubtractorMOG输出的蒙版上的凸壳
问题描述:
我使用BackgroundsubtractorMOG()
来基本上提取一个蒙版以分离出前景。然后我使用掩模上的convexHull()
来定位移动物体的位置。由BackgroundSubtractorMOG输出的蒙版上的凸壳
但我得到以下错误:
openCV Error: Assertion failed (nelems >= 0 && (depth == CV_32F || depth == CV_32S)) in convexHull, file /home/ameya/OpenCV2.4.2/modules/imgproc/src/contours.cpp, line 1947
terminate called after throwing an instance of 'cv::Exception'
what(): /home/ameya/OpenCV2.4.2/modules/imgproc/src/contours.cpp:1947: error: (-215) nelems >= 0 && (depth == CV_32F || depth == CV_32S) in function convexHull
我已经检查了没有。元素以及类型铸造掩模矩阵。但错误仍然存在。 有没有人遇到过类似的问题。我正在使用OpenCV 2.4.2
答
使用这种格式,这将有助于(通知类型转换到Mat
):
convexhull(Mat(inputarray),hull,0,0)
这要么是错误的号码传递给函数或错误的类型(不32F浮动或32S元素signed int),因为错误会显示它 – Georges 2016-11-26 10:18:55