MATLAB图像的形态学

bw = imread(‘text.png’);
se = strel(‘line’,11,90);%生成线形的结构元素
bw2 = imdilate(bw,se);%对图像进行膨胀
subplot(121), imshow(bw), title(‘原始图像’)
subplot(122), imshow(bw2), title(‘膨胀后的图像’)
在这里插入图片描述
I = imread(‘cameraman.tif’);
se = strel(‘ball’,5,5);%生成球形的结构元素
I2 = imdilate(I,se);%对图像进行膨胀
subplot(121), imshow(I), title(‘原始图像’)
subplot(122), imshow(I2), title(‘膨胀后的图像’)
在这里插入图片描述
I = imread(‘cameraman.tif’);
I1=256-I;%对图像进行取反操作
se = strel(‘ball’,5,5);%生成球形的结构元素
I2 = imdilate(I1,se);%对图像进行膨胀
I3=256-I2;%对膨胀后的图像取反
subplot(121), imshow(I), title(‘原始图像’)
subplot(122), imshow(I3), title(‘膨胀后的图像’)
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_38127487/article/details/115254211