Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Ellipse Fitting

Subject: Ellipse Fitting

From: djordjep@gmail.com

Date: 4 Dec, 2008 04:30:58

Message: 1 of 3

Hello all, i have a problem with ellipse fitting experiment i'm trying
to do for my class:

In an experiment of image processing, we have collected the scattered
data of an ellipse, which is contained in the data file and figure
attached in zip file.
Question asked is to estimate the location, size and orientation of
the ellipse from the scattered data and to draw the ellipse which best
fits the scattered data based on the estimation results.

http://www.pcprooncall.com/ellipse.zip

How would i go about using that set of data into my function? I tried
to open a file with data, but all i get
>> load('C:\Users\George\Documents\ellipse_v7.mat')
>>

And nothing happens after that.

Any help or pointers would be greatly appriciated. I'm not great with
Matlab, but i'm trying to learn

Subject: Ellipse Fitting

From: Roger Stafford

Date: 4 Dec, 2008 06:50:20

Message: 2 of 3

djordjep@gmail.com wrote in message <984e419b-b5fd-4acb-bf80-bcb09dffcce6@v15g2000yqn.googlegroups.com>...
> Hello all, i have a problem with ellipse fitting experiment i'm trying
> to do for my class:
> ........

  Here's one approach you might consider. Assuming you are in two dimensional space, any ellipse can be described by the equation

 A*x^2 + B*x*y + C*y^2 + D*x + E*y + F = 0

with appropriate values of A, B, C, D, E, and F. If x, y, and z are column vectors of the three corresponding coordinate of your data points, form the matrix M:

 M = [x.^2,x.*y,y.^2,x,y,ones(size(x))];

Then use the singular value decomposition function:

 [U,S,V] = svd(M,0);

The sixth (last) column of V will contain the least squares values of [A;B;C;D;E;F] subject to the restriction that the sum of their squares is one. (This latter is necessary because the ellipse's equation is homogeneous in the six coefficients.)

  For many (but not all) point sets this can be considered a "best" fit to an ellipse. One drawback it possesses is that this solution does not remain strictly invariant with respect to translations of the coordinate system.

Roger Stafford

Subject: Ellipse Fitting

From: Rafael Herrejon

Date: 4 Dec, 2008 18:31:02

Message: 3 of 3

djordjep@gmail.com wrote in message <984e419b-b5fd-4acb-bf80-bcb09dffcce6@v15g2000yqn.googlegroups.com>...
> Hello all, i have a problem with ellipse fitting experiment i'm trying
> to do for my class:
>
> In an experiment of image processing, we have collected the scattered
> data of an ellipse, which is contained in the data file and figure
> attached in zip file.
> Question asked is to estimate the location, size and orientation of
> the ellipse from the scattered data and to draw the ellipse which best
> fits the scattered data based on the estimation results.
>
> http://www.pcprooncall.com/ellipse.zip
>
> How would i go about using that set of data into my function? I tried
> to open a file with data, but all i get
> >> load('C:\Users\George\Documents\ellipse_v7.mat')
> >>
>
> And nothing happens after that.
>
> Any help or pointers would be greatly appriciated. I'm not great with
> Matlab, but i'm trying to learn

to be able to see the data, you have assign it to something,for example
    data=load('C:\Users\George\Documents\ellipse_v7.mat')
    x = data(:,1)';
    y = data(:,2)';

etc

btw, there are some fitellipse functions in FileExchange

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us