Best Elliptical Fit for irregular shape

1 回表示 (過去 30 日間)
Kazekage Sama
Kazekage Sama 2013 年 12 月 13 日
コメント済み: Image Analyst 2013 年 12 月 14 日
Hi;
I am trying to find the best elliptical fit for irregular shapes in a matrix, say my matrix is defined as:
0 0 0 0 0 0 0 0 0 0 0;
0 0 1 1 1 0 0 0 0 0 0;
0 0 0 1 1 1 1 0 0 0 0;
0 0 0 0 1 1 1 0 0 0 0;
0 0 0 0 0 1 1 1 0 0 0;
0 0 0 0 0 0 0 0 0 0 0;
how can I get the best ellipse fit for this block of ones in the middle of the image? A reference document is much appreciated.
thanks

回答 (1 件)

Matt J
Matt J 2013 年 12 月 13 日
regionprops(Image,'MajorAxisLength', 'MinorAxisLength', 'Centroid', 'Orientation')
  4 件のコメント
Kazekage Sama
Kazekage Sama 2013 年 12 月 14 日
Yes...basically I need the logic to be test in MATLAB first then implement it using VHDL. That's why I care about the details of the code.
I heard that I need to find the centre of gravity and things like this, but I don't know what they basically are and how to get them correct.
Image Analyst
Image Analyst 2013 年 12 月 14 日
You know how to find the center of gravity - it's just (in pseudocode)
cogX = sum(x*yourimage)/sum(yourImage)
That gets you the center of gravity in the x direction. That code won't work as is but see if you can translate it into code that does work.

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

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by