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

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

this is the result(the green points is the inner points, the red is the noise, the blue is the center)

edit retag close merge delete

Sort by ยป oldest newest most voted

I needed a robust ellipse fit out of contour points from OpenCV. I found this paper:
https://www.princeton.edu/~kulkarni/Papers/Journals/j074_2010_YuZhengKulPoor_EURASIP.pdf

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.

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!

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

Official site

GitHub

Wiki

Documentation

## Stats

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

Seen: 2,043 times

Last updated: Oct 16 '14