gusucode.com > 《matlab图像处理与界面编程宝典》秦襄培 编著,每章的MATLAB源代码程序 > 第2章/代码2-4.txt
代码2-4 P=imread('t1.jpg'); I=rgb2gray(P); L = bwlabel(I); s = regionprops(L, 'centroid');% 'Centroid'见表2-4 centroids = cat(1, s.Centroid); imshow(I,[]) hold on plot(centroids(:,1), centroids(:,2), 'b*') hold off