MATLAB: How regionprops orders the regions

connected components labelingimage processingImage Processing Toolboxregionprops

Hello all,
I am confused how regionprops organizes the results? I have a picture that has 7 dark spots on it and need to calculate the area of each.Using regionprops, it shows the areas in pixels but in a confusing order! Is there anyway that I can get the results in an understandable order? like vertically or horizontally with the corresponding area?
Thank you Faraz

Best Answer

The blobs are labeled/ordered/identified/numbered by bwconncomp() or bwlabel(). The order is column major order like most things in MATLAB.
So it goes down the image starting in the upper left pixel and goes down the first column. If it "sees" a pixel that's part of a blob that is not yet labeled, then it does a region growing to label that whole blob, even if it goes off into other rows and columns to the right or above. Then, once that blob is labeled, it continues on to find any other blobs. It proceeds like this top-to-bottom, left-to-right (i.e. column-by-column) until it has found and labeled every blob.
Does that explain it well enough?
Related Question