www.gusucode.com > 《matlab图像处理与界面编程宝典》秦襄培 编著,每章的MATLAB源代码程序 > 第2章/代码2-3.txt
stats = regionprops(L,'Area'); bw = imread('text.png'); L = bwlabel(bw); s = regionprops(L, 'centroid'); centroids = cat(1, s.Centroid); imshow(bw) hold on %保持状态以便在原始图像上添加质心矢量图 plot(centroids(:,1), centroids(:,2), 'b*') % hold off