MATLAB: The ‘Perimeter’ option in regionprops()

Image Processing Toolboxregionprops

Hi all,
I am trying to use regionprops(data,'Perimeter') to calculate the individual boundary of discontigous regions in an image and it returned values seem to be reasonable.
However, when I read the documentation, it states that "If the image contains discontiguous regions, regionprops returns unexpected results." which I don't really understand what does unexpected results mean? Does it imply that this function cannot calculate the perimeters of discontiguous regions?
p.s. below is the image and I was trying to calculate the perimeter of each individual yellow regions.
I got an array of perimeter = [35.0490,5.9050,4.9620,28.0110,34.2470].
Thanks

Best Answer

No, it should be fine. I believe it's talking about a very special/rare situation where you have blobs that are disconnected but you want to treat them as one blob. Like your image has 5 blobs but for some reason you wanted to treat them all as one region. You can do that but some measurements, might not make sense. I believe what you want to do is to treat all 5 blobs as separate regions and get 5 perimeters and it will work fine for that
props = regionprops(binaryImage, 'Perimeter'); % returns a structure array.
allPerimeters = [props.Perimeter]