How to calculate solidity of different shapes

Illustration
naila - 2023-12-29T19:51:15+00:00
Question: How to calculate solidity of different shapes

I have an image which contains different shapes:     I want to calculate the solidity of each shape individually and pick the one which has greatest solidity;   Can any one help me regarding this?  

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

Did you use regionprops() to get all of them? If so, then just sort
 
 
% Label the binary image.
labeledImage = bwlabel(binaryImage);
% Measure the solidity of all the blobs.
measurements = regionprops(labeledImage, 'Solidity');
% Sort in oder of decreasing solidity.
[sortedS, sortIndexes] = sort([measurements.Solidity], 'descend');
% Get the solidity of the most solid blob
highestSolidity = sortedS(1);
% Get the label of the most solid blob
labelWithHighestSolidity = sortIndexes(1);

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!