フィルターのクリア

Crop object from image

1 回表示 (過去 30 日間)
Akos
Akos 2013 年 6 月 17 日
I am using code something like this to detect and count object on image.
BW = imread('blobs.png');
[B,L,N,A] = bwboundaries(BW);
figure, imshow(BW); hold on;
colors=['b' 'g' 'r' 'c' 'm' 'y'];
for k=1:length(B)
boundary = B{k};
cidx = mod(k,length(colors))+1;
plot(boundary(:,2), boundary(:,1),...
colors(cidx),'LineWidth',2);
%randomize text position for better visibility
rndRow = ceil(length(boundary)/(mod(rand*k,7)+1));
col = boundary(rndRow,2); row = boundary(rndRow,1);
h = text(col+1, row-1, num2str(L(row,col)));
set(h,'Color',colors(cidx),...
'FontSize',14,'FontWeight','bold');
end
figure; spy(A);
I want to save each founded object one by one to an image file. How could i do this? Thank for your help!

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 6 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by