필터 지우기
필터 지우기

circle fitting

조회 수: 5 (최근 30일)
Khawaja Asim
Khawaja Asim 2012년 3월 1일
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일
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
Khawaja Asim
Khawaja Asim 2012년 3월 2일
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?
Image Analyst
Image Analyst 2012년 3월 2일
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일
  댓글 수: 3
Khawaja Asim
Khawaja Asim 2012년 3월 2일
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???
Image Analyst
Image Analyst 2012년 3월 2일
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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by