Image Matlab-根据regionprops过滤标记矩阵

Image Matlab-根据regionprops过滤标记矩阵,image,matlab,image-processing,Image,Matlab,Image Processing,我已经标记了一个图像(使用bwlabel),然后,我使用regionprops获取标记对象的偏心度。我现在要做的是过滤每个偏心率低于0.5的标记对象 到目前为止,我已经能够使用find获得那些符合条件的区域的数量,但我不知道如何使用它们来过滤原始标记图像 例如: labeledImage = bwlabel(originalImage); properties = regionprops(labeledImage, 'eccentricity'); eccentricities = cat(1,

我已经标记了一个图像(使用
bwlabel
),然后,我使用
regionprops
获取标记对象的偏心度。我现在要做的是过滤每个偏心率低于0.5的标记对象

到目前为止,我已经能够使用
find
获得那些符合条件的区域的数量,但我不知道如何使用它们来过滤原始标记图像

例如:

labeledImage = bwlabel(originalImage);
properties = regionprops(labeledImage, 'eccentricity');
eccentricities = cat(1, properties.Eccentricity);

regions = find(eccentricities > 0.5);
% now what?

我曾试图用<代码>做< /COD>循环,但它是缓慢的地狱,我确信必须有一个隐藏的Matlab函数来完成它。

OK,看起来函数<代码>成员< /代码>做了这个把戏,但是我确信你们知道更好的方法。

< P>如果你仍在试图解决这个问题,请考虑下面的例子:

BW = imread('text.png');

CC = bwconncomp(BW);
L = labelmatrix(CC);

props = regionprops(CC, 'eccentricity');
idx = ( [props.Eccentricity] > 0.6);

BW2 = ismember(L,find(idx));    %# filter components with Eccentricity>0.6
BW3 = ismember(L,find(~idx));   %# filter components with Eccentricity<0.6

subplot(131), imshow(BW)
subplot(132), imshow(BW2)
subplot(133), imshow(BW3)
BW=imread('text.png');
CC=BWConComp(BW);
L=labelmatrix(CC);
道具=区域道具(CC,“偏心度”);
idx=([道具偏心率]>0.6);
BW2=ismember(L,find(idx));%偏心率>0.6的过滤器组件
BW3=ismember(L,find(~idx));%偏心过滤元件