我试图找到图像中最大的对象并删除图像中小于它的任何其他对象。
这就是我所拥有的,但我无法让它工作。
l=bwlabel(BW);
%the area of all objects in the image is calculated
stat = regionprops(l,'Area','PixelIdxList');
[maxValue,index] = max([stat.Area]);
%remove any connected areas smaller than the biggest object
BW2=bwareaopen(BW,[maxValue,index],8);
subplot(5, 5, 4);
imshow(BW2, []);
我正在使用诸如这些的数字乳房 X 线照片。我正在尝试从图像中删除除乳房区域之外的所有对象。