Circularity of an image

5 次查看(过去 30 天)
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???

采纳的回答

Mohammad Abouali
Mohammad Abouali 2014-12-2
编辑:Mohammad Abouali 2014-12-2
does it have to be circularity?
Can you replace circularity with the ratio between major/minor axis length?
  5 个评论
Mohammad Abouali
Mohammad Abouali 2014-12-3
The sizes are in pixels. So if your images don;t have the same spatial pixel size then 1pixel in first image could refer to 1meter, in the second image one pixel refers to 10meter (well the numbers are just examples).
So the sizes never come out exactly the same.
But why it is giving too many zeros. I don't know. I have to check the image and then perhaps I may find out.
purti choudhary
purti choudhary 2014-12-3
This is one of the image for which i am calculating perimeter.
And permiter(97x1) matrix is likewise

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
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 个评论
purti choudhary
purti choudhary 2014-12-6
Thank you very much... This labelled image is a grayscale image??
Image Analyst
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);

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by