Ask Your Question

program crashes during cv::findcontours execution

asked 2013-12-19 07:41:11 -0500

 std::vector<std::vector<cv::Point> > contours;

std::vector<cv::Vec4i> hierarchy;

cv::findContours(ThreshIm,contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE);

cv::fillPoly(ThreshIm,contours,Scalar(255)); cv::drawContours(frame,contours,-1,Scalar(0,255,0),3);

// cv::RotatedRect box= cv::minAreaRect(Mat(contours[0]));

While taking a live input from camera, the program runs successfully until the cv::RotatatedRect is not included in the code,but as soon as the program is run with this line, the program crashes. What might be happening?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-12-19 08:27:55 -0500

Haris gravatar image

You may need to check the contours are there before drawing contour, like

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-12-19 07:41:11 -0500

Seen: 524 times

Last updated: Dec 19 '13