Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

findContours Function causes crash across Windows & Ubuntu

$
0
0
When I use the OpenCV function findContours() my c++ application crashes. I've reproduced the error on both Windows 8.1 and Ubuntu. I've run into this crash before with the same function in my other OpenCV applications. Sometimes creating a new project and copying the exact same code resolves/avoids the error. Below is the error message for both operating systems. Any advice what is going wrong? Ubuntu Error: > OpenCV Error: Assertion failed (mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0)) in create, file /home/me/opencv/modules/core/src/matrix.cpp, line 2383 terminate called after throwing an instance of 'cv::Exception' what(): /home/me/opencv/modules/core/src/matrix.cpp:2383: error: (-215) mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) in function create Windows 8.1 error: ![image description](http://i.stack.imgur.com/IosQR.png) The line of code causing the error has been commented below. Note both Mat objects are not null and of the same size (640x480). I am using OpenCV 3.0 void trackMovingObject(Mat& thresholdImg, Mat& cameraFeed) { std::vector> contours; std::vector hierarchy; // Crash occurs at below line // thresholdImg is created from cv::threshold() findContours(thresholdImg, contours, hierarchy, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>