Returning specific regions [closed]

十年热恋 提交于 2019-12-14 03:32:41

问题


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.


回答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


来源:https://stackoverflow.com/questions/20680251/returning-specific-regions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!