Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

findContours Exception

Hi, I just have simple code to find the contours in an image :

vector <vector<Point2i>>cont;
frame = imread("hw.jpg");
cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
background = imread("background.jpg");
//convert background to grayscale
cvtColor(background, background_gray, COLOR_BGR2GRAY);
//perform frame differencing
absdiff(background_gray, frame_gray, DifferenceImage);
//obtain threshold image
threshold(DifferenceImage, ThresholdImage, 45, 255, THRESH_BINARY);
//blur image
blur(ThresholdImage, BlurImage, Size(40, 40));
threshold(BlurImage, ThresholdImage2, 45, 255, THRESH_BINARY);
findContours(ThresholdImage2, cont, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
imshow("Capture", frame);
imshow("Threshold Image", ThresholdImage2);
cvWaitKey(50);

I get the exception "An invalid parameter was passed to a function that considers invalid parameters fatal." What's wrong ? Thanks

findContours Exception

Hi, I just have simple code to find the contours in an image :

vector <vector<Point2i>>cont;
frame = imread("hw.jpg");
cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
background = imread("background.jpg");
//convert background to grayscale
cvtColor(background, background_gray, COLOR_BGR2GRAY);
//perform frame differencing
absdiff(background_gray, frame_gray, DifferenceImage);
//obtain threshold image
threshold(DifferenceImage, ThresholdImage, 45, 255, THRESH_BINARY);
//blur image
blur(ThresholdImage, BlurImage, Size(40, 40));
threshold(BlurImage, ThresholdImage2, 45, 255, THRESH_BINARY);
findContours(ThresholdImage2, cont, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
imshow("Capture", frame);
imshow("Threshold Image", ThresholdImage2);
cvWaitKey(50);

I get the exception "An "Unhandled exception at 0x6F04C3A2 (ucrtbase.dll). An invalid parameter was passed to a function that considers invalid parameters fatal." What's wrong ? Thanks