I have developed a system that detects & tracks the face of a person(real time, with usb camera). From that data I want to collect parameters from the eyes (blinks for example). Everything works fine until I try to use the command findContour,
std::vector< std::vector<cv::Point> > contours;
cv::findContours( test, contours, CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE );
I've tried this for a couple of days now, but I cant figure it out how to make it work. Examples from internet doesnt work either.
Before I run the method cv::findContours() I run the following methods:
m = ~currentWebCamFrame(trackP.EyePosition(false));
cv::cvtColor(m,n, CV_RGB2GRAY);
cv::threshold(n, m, threshold-value, 255,CV_THRESH_BINARY);
cv::erode(m, n, cv::Mat(),cv::Point(-1,-1),n_erode_dilate);
cv::dilate(n, m, cv::Mat(),cv::Point(-1,-1),n_erode_dilate);
test = m.clone();
When I output the image "test" this is the result:
Before I run the "findContour()" I test the following:
if((!test.empty()) && (test.type() == CV_8UC1)){ };
There is no available error message from opencv, the program just crashed. I printf() some text right before and after. And it is only the text before that is visible in the console.
The message from Visual studio is:
Windows has triggered a breakpoint in eyeTracking.exe.
This may be due to a corruption of the heap, which indicates a bug in the eyeTracking.exe or any of the DLLs it has loaded.
This May also be due to the user pressing F12 while eyeTracking has focus.
I dont know what to do, so if there is anyone that has any idea, please let me know!
Thanks!