Circularity of an image
이전 댓글 표시

I am trying to find circularity for my shape feature requirement in MRI image classification. I have used the matlab function REGIONPROPS to find area and perimeter and the circularity formula: 4*pi*area/(perimeter)^2.
My problem is i am getting perimeter as 0 value for many regions in an image. Then circularity will become infinite. I have attached a screenshot of perimeter values i am getting for a single image. Someone please suggest me how to calculate circularity in such case???
채택된 답변
추가 답변 (1개)
Image Analyst
2014년 12월 3일
What is the area of the blobs that have zero perimeter? Is it 1? Like 1 pixel? If so, maybe you just don't want to consider those. You can use bwareaopen() to filter out tiny things. By the way, I use the inverse of your equation.
allAreas = [measurements.Area];
allPerimeters = [measurements.Perimeter];
circularities = allPerimeters .^ 2 ./ (4 * pi * allAreas);
Of course zero perimeter is not a problem there.
댓글 수: 11
Image Analyst
2014년 12월 3일
By the way, you shouldn't call regionprops() twice. Just get everything all in one shot:
measurements = regionprops(logical(BW), 'Area', 'Perimeter');
purti choudhary
2014년 12월 3일
Image Analyst
2014년 12월 3일
OK, so like I thought, the solution is to call bwareaopen(binaryImage, 1) to get rid of pixels that are of size 1 or less. Personally I'd use a min blob size of a few hundred.
Image Analyst
2014년 12월 3일
Attach your script if you want me to try it. Also, im2bw() is usually not good at picking thresholds in my experience. Anyway, you probably need to call imfill(binaryImage, 'holes') after you call im2bw().
purti choudhary
2014년 12월 4일
Image Analyst
2014년 12월 4일
Where's your script so I can try it?
purti choudhary
2014년 12월 5일
purti choudhary
2014년 12월 5일
Image Analyst
2014년 12월 5일
That's a poor decision.
And why didn't you take my advice on how to calculate things:
measurements = regionprops(labeledImage, 'Area', 'Perimeter');
allAreas = [measurements.Area];
allPerimeters = [measurements.Perimeter];
circularities = allPerimeters .^ 2 ./ (4 * pi * allAreas);
purti choudhary
2014년 12월 6일
Image Analyst
2014년 12월 6일
It's an integer valued image. You can display it as a grayscale image if you want
imshow(labeledImage, []);
Or you can pseudocolor the blobs and show that:
% Assign labeled blobs rainbow colors.
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle');
imshow(coloredLabels);
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

