clear; clc;
f=imread('c:\1.jpg'); gray_level=graythresh(f); f=im2bw(f,gray_level); [l,n]=bwlabel(f,8)
imshow(f) hold on for k=1:n [r,c]=find(l==k); rbar=mean(r); cbar=mean(c); plot(cbar,rbar,'Marker','o','MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',10); plot(cbar,rbar,'Marker','*','MarkerEdgecolor','w'); end
|