crop multiple objects from binary image

2 次查看(过去 30 天)
hi, everyone how can i crop multiple objects and show it's from my code
warning off img = imread('6.jpg');
img = rgb2gray(img); imshow(img);
level = graythresh(img); BW = im2bw(img,level); figure, imshow(BW);
BW1 = imclearborder(BW); figure, imshow(BW1);
CC = bwconncomp(BW1, 8); S = regionprops(CC, 'Area'); L = labelmatrix(CC); P = 1500; BW2 = ismember(L, find([S.Area] >= P)); figure, imshow(BW2);
st = regionprops(BW2, 'BoundingBox' ); L = labelmatrix(CC); for k = 1 : length(st) thisBB = st(k).BoundingBox; rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],... 'EdgeColor','r','LineWidth',2 ) end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by