Running problem with opencv 2.4.0 The findContours function is constantly crashing. Unfortunately, it was very difficult for me to identify the problem. Hope someone ran into a similar problem.
I collect a depth stream from a Kinect sensor using the Microsoft K4W SDK 1.5, copying it to Matrix OpenCV, and then converting it to an 8UC1 image via cvtColor and threshold. I run countNonZero to make sure the image is not empty before passing it to findContours. But even the simplest findcountours implementation crashes.
Here is my base code:
rawdepth = Mat(Size(640,480),CV_8UC4); thresh = Mat::zeros(640,480,CV_8UC1); // storage for contours vector<vector<Point>> contours; cvtColor(rawdepth,thresh,CV_RGB2GRAY); threshold(thresh,thresh,0,255,THRESH_BINARY); if(countNonZero(thresh) > 100 ) { // This crashes findContours(thresh,contours,RETR_EXTERNAL,CV_CHAIN_APPROX_NONE); }
I made sure that the actual Mat passed to findcontours is a single-channel image and that it is not empty (i.e. there are more than 500 + points). But I am wondering if this is a heap or thread problem, since I heard that findcontours can really modify the input Mat file?
At this point, I will try to use OpenCV 2.4.1, which has just been released, although I do not see any fixed errors that indicate a fix for this problem.
Any ideas are greatly appreciated ...
eclay source share