0

我有一个二进制图像,我想省略其中长/宽比超过阈值的那些对象。我使用下面的代码来提取对象的一些属性:

labeledImage = bwlabel(my_image, 8);
regioninfo = regionprops(labeledImage,'MajorAxisLength','MinorAxisLength','PixelIdxList');
lengths = [regioninfo.MajorAxisLength];   %array
widths = [regioninfo.MinorAxisLength];    %array
logidx = (lengths ./ widths) < threshold;
extracted_objs = regioninfo(logidx);      % 24*1 structer

现在我需要知道如何准确使用 PixelIdxList 值来显示剩余部分

提前致谢

4

1 回答 1

0

再次,回答我自己的问题......在其他地方找到了答案!把它放在这里给像我这样可能需要的人:

labeledImage = bwlabel(my_image, 8);
regioninfo = regionprops(labeledImage,'MajorAxisLength','MinorAxisLength','PixelIdxList');
figure,vislabels(labeledImage ),title('Visualized labels of connected components');
lengths = [regioninfo.MajorAxisLength];   %array
widths = [regioninfo.MinorAxisLength];    %array
logidx = (lengths ./ widths) < threshold;
Keeper_Indexes=find(logidx);
Keeper_Building_Image=ismember(labeledImage,Keeper_Indexes);
figure,imshow(Keeper_Building_Image);title('thresholded image by Ratio');
于 2013-09-19T07:01:13.593 回答