Ask Your Question

how to fit an ellipse to 2D data with random three points and thire gradient?

asked 2014-10-14 21:54:21 -0500

qinling123 gravatar image

i need to fit an ellipse to 2D data with random three points and their gradient. and the points is the edge points of one image. i use the Opencv function to calculate the gradient of each point.

i konw the RANSAC algorithm can do this job. and this algorithm can find the inner points fitting the ellipse and reject the noise points. but this algorithm uses five random points and it increases the sample times. so i want to improve this algorithm.

now considering the ellipse property, i find the three random points and their gradient can fit an ellipse. i have done this job combining the RANSAC algorithm. i choose three random points, calculate the ellipse center with their gradient. when i choose the fourth point and add some constraint of the ellipse. lastly, i find the inner points. but it doesnot work well.

so i want to know how to make this job well, especially restraining the fourth point with the ellipse property.

thanks! this is all the points enter image description here

this is the result(the green points is the inner points, the red is the noise, the blue is the center) enter image description here

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-10-16 14:02:42 -0500

matman gravatar image

I needed a robust ellipse fit out of contour points from OpenCV. I found this paper:

It uses a combined outlier detection. At first proximity is checked. In the second step a model based detection is used. It seems to be much faster and more robust than RAMSAC.

Because the findContour algorith from OpenCV gives me only points with direct proximity, I only had to programm the model based algoritm. For 5000 points the calculation time is about 1ms for choosing inliners, with SSE Intrinsics its about 0,2ms on an Intel Q9300 processor.

edit flag offensive delete link more


May you want to share your implementation of that algorithm? That would be awesome! I'm looking for the exact same thing, and it would be very nice to save the time for implementing this. Greetings from Leipzig!

Chrizzy gravatar imageChrizzy ( 2016-07-26 06:54:47 -0500 )edit

Question Tools


Asked: 2014-10-14 21:54:21 -0500

Seen: 2,044 times

Last updated: Oct 16 '14