How to retrieve the centroid and angle of an ellipse drawn on an image in a gui?

2 ビュー (過去 30 日間)
Nisha Bharti
Nisha Bharti 2016 年 6 月 7 日
回答済み: Image Analyst 2016 年 6 月 7 日
I want to create an interactive ellipse on an image in a gui and retrieve its poperties like semi-major axis,semi-minor axis, angle and centroid for the same. I am struck at this. Using imellipse, I am not able to get the centroid and the angle. I have to get these values in a structure and then generate a xml file of it. Thanks!

回答 (2 件)

Matt J
Matt J 2016 年 6 月 7 日
If you have a well-distributed set of points on the ellipse, you can use the attached file to fit the points. The output gives all the ellipse parameters that you mentioned.
  2 件のコメント
Nisha Bharti
Nisha Bharti 2016 年 6 月 7 日
It's giving this error:
Attempted to access XY(2,:); index out of bounds because numel(XY)=1.
Error in ellipsefit (line 6) Y=XY(2,:).' - cxy(2);
Matt J
Matt J 2016 年 6 月 7 日
編集済み: Matt J 2016 年 6 月 7 日
The error means that you have called ellipsefit(XY) with a scalar value for XY. The expectation is that XY is a 2xN matrix whose columns are N points on the ellipse.

サインインしてコメントする。


Image Analyst
Image Analyst 2016 年 6 月 7 日
See my attached demo which will draw ellipses at various angles.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by