circle fitting

I have a binary image. This image contains white points randomly a ranged inside a region of interest. I want to draw a circle that can include all these points inside it. Means that I want to write a code that detect all these active points automatically and draw a circle in such a way that all the active (white) points come inside this circle. And outer most white point become a part of the boundary of circle. Can anyone help me in that?

 采纳的回答

Walter Roberson
Walter Roberson 2012-3-1

0 个投票

regionprops() the binary image, asking for Centroid and ConvexHull.
The center of the circle will be the centroid.
The ConvexHull will be an N x 2 array of x+y points. The point in that list that is furthest from the centroid will be the point that must be passed through; i.e., that maximum distances will be the radius of the circle.
You could also use the PixelIDList instead of the ConvexHull; it just gives you more points whose distance would have to be calculated.

3 个评论

I think that could be approximately right for "normal" cases, yet not right for "pathological" cases. Imagine a bunch of dots up near the top of the circle and only one single outlier point down near the bottom of the circle.
Thank you for your help. I think image analyst is right. May I send u both few images. After seeing images, suggest something, or do that for me?
Then don't accept the answer yet. We don't take personal emails - virtually no one here does. You can post your pictures to tinypic.com, or check here: http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2012-3-1

0 个投票

3 个评论

this is something impressive. I will have a look at it.
One thing that I have forgot to mention that, these points may not be evenly distributed. They may form an arc, or more maximum number of points can gather on one side, will it work on that also???
Neither Walter's nor John's solution will work if you have a random smattering of dots along the top of an arc. In that case you'd have to do a fit. Apparently that's complicated. I have a paper or reference to fitting a circle that I'll try to look up later for you.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Smoothing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by