Optimize ellipse to fit shapes in images

1 回表示 (過去 30 日間)
Anders
Anders 2011 年 10 月 2 日
Hi,
Given an image with various shapes, I am trying to fit ellipses that match these shapes the best by varying the ellipse parameters a, b and the angle of the ellipse. So far, using a for-loop and trying all possible combination results in code that works very well but is dreadfully slow (script takes more than 20 min per ellipse and I have hundreds of ellipses to fit).
I wonder, therefore, whether MatLab has a good optimization tool for this. Basically, I feed the ellipse-function the image, the x- and y-pixel coordinates and want it to find the optimal ellipse angle and a and b values (given constraints on a and b). My question is, is there a good, robust and fast way of doing this in MatLab?

採用された回答

Image Analyst
Image Analyst 2011 年 10 月 2 日
You're in luck! This is a built-in capability. Take a look at regionprops() in the Image Processing Toolbox. You'll need the MajorAxisLength, MinorAxisLength, and Orientation measurements so be sure to ask regionprops to return those measurements.
  3 件のコメント
Image Analyst
Image Analyst 2011 年 10 月 2 日
Use imfill() to fill in the holes. See if that will then get you better results.
Image Analyst
Image Analyst 2011 年 10 月 2 日
You aren't working on this same project that several others are, are you? http://www.mathworks.com/matlabcentral/answers/16908-segmentation-of-overlapping-objects

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by