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!

