Fitting a circle of known radius to a binary image

2 次查看(过去 30 天)
I have some binary images to which I would like fit the largest possible circle.
The method I am currently thinking of using is finding the maximum radius using regionprops and fitting that max radius circle to the boundary pixels of the blobs (bwboundaries) (see picture below). I cannot use Hough as the circle all have different radius and often leads to a very noisy output. I have also tried using a least squares algorithm with no radial constraint, but the radius outputted is often to small.
Could someone help me implement something like this, but for matlab, point me to a suitable algorithm or give any better suggestions?
Many thanks :)

采纳的回答

Image Analyst
Image Analyst 2020-3-15
You can simply measure all the areas and equivalent circular diameters and you're pretty much done.
props = regionprops(mask, 'Area', 'EquivDiameter');
allAreas = [props.Area]
allDiameters = [props.EquivDiameter]
[largestArea, indexOfLargestArea] = max(allAreas)
largestDiameter = allDiameters(indexOfLargestArea)
The equivalent circular diameter is the diameter your blob would have as if all the pixels were rearranged into a perfectly circular shapte.
  4 个评论
Image Analyst
Image Analyst 2020-3-15
You might want to look at this:
Pass all the points from your blob into that function to get the outermost circle that will contain everything. But what if you have just some irregularly shaped blob, not like a perfect hemicircle or full circle? What if is just looks like an amorphous blob or splat? What outline would you want to use? Why not use the fitted circle? Or the convex hull? Do you know for a fact that your original objects are circles that have had a chord clipped off of them?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by