实验三 图像复原
1. 实验目的
熟悉数字图像边缘检测与形态学变换的一般方法 2. 实验内容
1)练习边缘检测的Matlab命令。 2)练习形态学变换的Matlab命令。 熟悉下列模块函数 edge fspecial bwselect bwmorph dilate imnoise bwperim
2) 在VC环境下利用例程了解和熟悉数字图像复原的方法。 熟悉例程提供的图像复原菜单下的子菜单
3.实验程序
1、rice.tif的边缘检测 I = imread('rice.tif'); BW1 = edge(I,'prewitt'); BW2 = edge(I,'sobel'); BW3 = edge(I,'canny');
subplot(2,2,1),imshow(BW1) subplot(2,2,2),imshow(BW2) subplot(2,2,3), imshow(BW3)
2、加入高斯燥声的边缘检测
I=imread('rice.tif');
J=imnoise(I,'gaussian',0,0.02); subplot(2,2,1),imshow(I); subplot(2,2,2),imshow(J); BW1 = edge(J,'prewitt'); BW2 = edge(J,'sobel'); BW3 = edge(J,'canny'); figure,imshow(BW1) figure,imshow(BW2) figure, imshow(BW3)
3、原图 高斯燥声 椒盐燥声
I=imread('rice.tif');
J1=imnoise(I,'gaussian',0,0.02); J2=imnoise(I,'salt & pepper',0.02); subplot(2,2,1),imshow(I); subplot(2,2,2),imshow(J1);
subplot(2,2,3),imshow(J2)
2、加入椒盐燥声的边缘检测
I=imread('rice.tif');
J=imnoise(I,'salt & pepper',0.02); subplot(2,2,1),imshow(I); subplot(2,2,2),imshow(J); BW1 = edge(J,'prewitt'); BW2 = edge(J,'sobel'); BW3 = edge(J,'canny'); figure,imshow(BW1) figure,imshow(BW2) figure, imshow(BW3)
4.实验结果
rice.tif的边缘检测
原图 高斯燥声 椒盐燥声
加入高斯燥声的边缘检测
加入椒盐燥声的边缘检测 5.实验总结
通过这次实验,学习了MATLAB命令,在VC环境下利用例程了解和熟悉数字图像边缘检测与形态学变换的方法。虽然实验有点错误,但还是改正过来并掌握了它,我希望在以后学习中,能更多去实践和运用所学知识。