How do I get labels from regionprops?

I'm passing in a labeled image from the watershed transform function into regionprops, but I don't get any labels associated with each of the regions' properties. In the documentation for regionprops, it says that there is an additional property called 'LabelName', but it's not being returned to me from regionprops even though I'm passing in a labeled image. Is there a way to get the original labels from the labeled image I passed into regionprops? Any advice or tips would be greatly appreciated. Thank you!

Answers (1)

Not sure what you want. The values of the pixels in the labeled image are the label number. When regionprops gives you the structure array, the index of the structure array is the label number and has all the measurements for the blob with that label number. If you're getting a table back, the the row number in the table is the label number. regionprops gives an output that has the same labels as the labeled image you passed in to it.

1 Comment

Oh ok, I see. I'll just use the index as the label name.

Sign in to comment.

Products

Release

R2022b

Asked:

on 12 Nov 2022

Commented:

on 12 Nov 2022

Community Treasure Hunt

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

Start Hunting!