Why does bwperim give wrong perimeter?

조회 수: 3 (최근 30일)
Steven
Steven 2014년 4월 15일
답변: Walter Roberson 2014년 4월 15일
I wanted to get the perimeter of the following circle. I used two methods, but got completely different results!
1. I used bwperim (after getting binary):
%% BW is the binary image of original greyscale image
BW_perim = bwperim(BW);
L = sum(sum(BW_perim));
I got this:
2. I used imfindcircle:
[centers,radius] = imfindcircles(greyscale);
L2 = 2*pi*radius
and I got this:
The results are completely different. The first one value is about 7 times the second one (in dimensional domain, the second one is reasonable).
I do not know why! Interesting is that the area is almost correct and the results are similar, but the perimeter is not!
1. What is wrong with the first method? Because my other images are not full circles and I have to use bwperim to get the perimeter.
Thanks so much!

채택된 답변

Anand
Anand 2014년 4월 15일
편집: Anand 2014년 4월 15일
The circle you are trying to measure is not a perfect circle, so technically you can't use 2*pi*radius as the formula for perimeter. Moreover, even what bwperim returns is an approximation that is dependent on the connectivity used, the resolution of the image and how perimeters of small line segments in the binary image are computed.
I would continue using bwperim.
  댓글 수: 1
Steven
Steven 2014년 4월 15일
Thanks Anand. So which one is the closest to the true value?
How can I get almost the accurate perimeter?
Thanks!
Steven

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2014년 4월 15일
Consider using imclose() on the labeled image and then taking the perimeter.

Community Treasure Hunt

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

Start Hunting!

Translated by