图像处理:
基本源码如下:
其中Bw1是提取的图像对象,8指的是八邻域,默认邻域类型为4邻域,可对应进行适当修改。
clc;close all;close all;
BW1 = imread('circbw.tif');
% Find the perimeters of objects in the image.
% 找到图像中对象的周长。
BW2 = bwperim(BW1);
%BW2 = bwperim(BW1,8);
% Display the original image and the image showing perimeters side-by-side.
% 并排显示原始图像和显示周长的图像。
montage({BW1,BW2},'BackgroundColor','blue','BorderSize',5)
效果如图:


源码如下,显示图对应。
clc;close all;close all;
BW = imread('circles.png');
% Calculate the perimeters of objects in the image.
% 找到图像中对象的周长。
BW2 = bwperim(BW,8);
% Display the original image and the perimeters side-by-side.
% 并排显示原始图像和显示周长的图像。
imshowpair(BW,BW2,'montage')
工作区参数图如下:

后续的处理,未完待续。
该博客展示了如何使用MATLAB中的bwperim函数来检测图像中对象的周长。代码示例包括读取图像,计算对象周长,并通过montage或imshowpair函数并排显示原始图像和显示周长的图像。图像处理的重点在于对象轮廓的检测和可视化。
2299

被折叠的 条评论
为什么被折叠?



