Ask Your Question

El's profile - activity

2013-11-28 06:17:28 -0600 received badge  Editor (source)
2013-11-28 06:11:31 -0600 asked a question cvFitEllipse error in points (points >=5)

Hello, I have a code where I read several video files and find and draw the contours of the largest area detected. I use the rotatedRect function and the fitEllipse and I check if the points for the ellipse are > 6 because the fitEllipse function only works for points>6. It doesn't work for only one of the video files and gives me the error "-201 number of points should be >=5 in cvFitEllipse2 function". Does anyone know how I could fix this? The code of the box and the ellipse is the following:

Mat pointsf; Mat(contours[largest_contour_index]).convertTo(pointsf,CV_32F); RotatedRect bbox = fitEllipse(pointsf); ...................... ellipse(image, bbox.center, bbox.size*0.5f, bbox.angle, 0, 360, Scalar(0,255,0), 2, 8);