代码24-6.txt

来自「matlab宝典书籍源码 全部代码 希望大家喜欢」· 文本 代码 · 共 11 行

TXT
11
字号

bw = imread('circles.png');                        % 读入图像
L=bwlabel(bw);                                     % 图像标记
s=regionprops(L, 'centroid');                      % 求区域属性   
a=regionprops(L, 'area')                           % 求区域属性
centroids = cat(1, s.Centroid);                    
imshow(bw)                                         % 显示原始图像 
hold on                                            % 继续绘图
plot(centroids(:,1), centroids(:,2), 'b*')         % 质心标识,蓝色星号
hold off                                           % 停止继续绘图

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?