在下面的脚本中,我得到了外边框。
脚本:
I = imread('coins.png');
BW = imbinarize(I);
BW2 = imfill(BW,'holes');
imshow(BW2)
s = regionprops(BW2, 'BoundingBox', 'MajorAxisLength','MinorAxisLength', 'Centroid');
for k = 1 : length(s)
selectCoin = s(k).BoundingBox;
rectangle('Position', [selectCoin(1),selectCoin(2),selectCoin(3),selectCoin(4)],...
'EdgeColor','r','LineWidth',2 )
end
有没有办法获得内部边界框?
提前谢谢