how to find the right distance evaluation function of an ellipse

6 Ansichten (letzte 30 Tage)
Johannes Tischer
Johannes Tischer am 25 Sep. 2020
Kommentiert: Matt J am 29 Sep. 2020
I want to fit a 2D data set to an ellipse using the ransac algorithm . Therefore I use the an equation in polar coordinates, with the origin at the center of the ellipse and with the angular coordinate theta.
ft = fittype( @(a,b,theta,r) (a*b)./sqrt((b*cos(theta)).^2+(a*sin(theta)).^2), 'independent', 'theta', 'dependent','r', 'coefficients', {'a','b'});
fitLineFcn = @(points) fit(points(:,1),points(:,2),ft ) % type function handle
evalLineFcn = ... % distance evaluation function
[modelRANSAC, inlierIdx] = ransac(points,fitLineFcn,evalLineFcn, sampleSize,maxDistance);
How can I compute distances from an ellipse to the data. The example doesnt help me at all.

Antworten (1)

Matt J
Matt J am 25 Sep. 2020
  6 Kommentare
Johannes Tischer
Johannes Tischer am 28 Sep. 2020
You keep forgetting to attach your data. Why???
Why do you need my data ?? My problem is to combine an explicit function and the ellipse equation matrix. There is no data needed.
Matt J
Matt J am 29 Sep. 2020
How can I get your matrix ellipse equation in my fit() ?
Once you have fitted the ellipse, you have the major and minor axes lengths a and b. Assuming you convert your data to a cartesian coordinate system in which the major axis is the x-axis, the A matrix will be given by
A=[1./a.^2, 0;0 1./b.^2];

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by