Does anyone know , What is the pattern of labeling the objects by Regionprops function? you imagine I have 8 objects on image , I want to know how it does labeling , which object has the first label and which one the last one ?what is the pattern?

1 view (last 30 days)
Does anyone know , What is the pattern of labeling the objects by Regionprops function? you imagine I have 8 objects on image , I want to know how it does labeling , which object has the first label and which one the last one ?what is the pattern?
  1 Comment
Matt J
Matt J on 27 May 2014
I suspect it scans through the image pixels in linear index order. When it encounters an Image(i) where i doesn't belong to a previously located object, it starts looking for pixels connected to i, to define a new object. Then it starts the search again.
Since it's not documented, however, I doubt you're intended to rely on a particular ordering. Why do you think you need to?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 27 May 2014
Yes. It goes down the rows in the left column until it finds a "true" pixel. Then it does like a region growing to find all pixels attached to that one and labels it "1". When it's done it continues moving down the column until it hits the next unlabeled and does the same thing and labels it "2". Then when there are no more unlabeled pixels in that column, it moves over to the next column and does the same thing. So then it scans across the image column by column until eventually it has found all the blobs. So the labeling is basically done top to bottom, then left to right.
  2 Comments
Zohreh Tavakkoli
Zohreh Tavakkoli on 27 May 2014
Edited: Zohreh Tavakkoli on 27 May 2014
Thanks ,Is this pattern exist for labeling the centroid of objects , I have try to find the centroid of some objects in my image using Regionprops function, but the order of labeling did not follow this pattern ??
Image Analyst
Image Analyst on 27 May 2014
The objects (regions) are labeled, not the centroids. If I have a long snake going all the way across the image, and a small spot/disc that starts a few columns to the right of where the snake starts, the snake will be found first, and the spot will be found second (because it's in a column to the right of where the snake's first column is). Now the spot will have a centroid to the left of the snake because the snake goes all the way across the image while the spot does not. The spot centroid might be at column 100 while the snake centroid is at column 500. But that doesn't matter. You access the centroid with the label number of the blob and you don't need to worry about where it is.
What do you mean by "find the centroid of some objects" exactly? Have you seen my Image Segmentation Tutorial where I extract just some of the blobs based on things like their area? http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!