crop multiple objects from binary image
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!