- 4
- 0
- 约3.12千字
- 约 4页
- 2019-10-24 发布于浙江
- 举报
% 载入图像
Img = imread(star1.jpg);
if ndims(Img) == 3
I=rgb2gray(Img);
else
I = Img;
end
BW = im2bw(I, graythresh(I)); % 二值化
figure;
subplot(2, 2, 1); imshow(Img);
title(原图像, FontWeight, Bold);
subplot(2, 2, 2); imshow(Img);
title(网格标记图像, FontWeight, Bold);
hold on;
[xt, yt] = meshgrid(round(linspace(1, size(I, 1), 10)), ...
round(linspace(1, size(I, 2), 10)));
mesh(yt, xt, zeros(size(xt)), FaceColor, ...
None, LineWidth, 3, ...
EdgeColor, r);
subplot(2, 2, 3); imshow(BW);
title(二值图像, FontWeight, Bold);
[n1, n2] = size(BW);
r = floor(n1/10); % 分成10块,行
c = floor(n2/10); % 分成10块
原创力文档

文档评论(0)