-4

Say that I have a labeled image, where I have calculated the area of each region. How can I return specific regions? That is, say I want to return the regions that have >=300 and <500?

Thanks.

Simplicity
  • 47,404
  • 98
  • 256
  • 385

1 Answers1

1

You can group the results of regionprops into a vector and use it for indexing:

rg = regionprops( L, 'Area' );
allArea = [rg(:).Area]; % grouping all area values into a single vecotr
labels = find( allArea >= 300 & allArea < 500); % select relevant regions
Simplicity
  • 47,404
  • 98
  • 256
  • 385
Shai
  • 111,146
  • 38
  • 238
  • 371