Best Elliptical Fit for irregular shape
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Matt J
2013-12-13
regionprops(Image,'MajorAxisLength', 'MinorAxisLength', 'Centroid', 'Orientation')
4 个评论
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!