figure oriImg=imread('peppers.bmp');%读取并显示原有图像 subplot(1,2,1); imshow(oriImg); title ('原始图像');%显示原始图像 grayImg = rgb2gray(oriImg);%转成灰度图像 subplot(1,2,2); imshow(grayImg); title ('灰度图像');%显示灰度图像 figure %加入高斯噪声,使用邻域平均滤波 Inoise=imnoise(grayImg,'gaussian',0,0.02);%对图像加入高斯噪声 subplot(1,2,1); imshow(Inoise); title('加入高斯噪声后的图像');%显示高斯噪声图像 h=ones(3,3)/8; h(2,2)=0;%构造邻域窗口 filters=imfilter(Inoise,h);%邻域平均滤波 subplot(1,2,2); imshow(filters); title('8邻域平均滤波后的图像') figure %加入椒盐噪声,使用中值滤波 Inoise=imnoise(grayImg,'salt & pepper');%加入椒盐噪声 subplot(
基于matlab的图像处理——高斯噪声&均值滤波,椒盐噪声&中值滤波
最新推荐文章于 2024-07-10 11:46:50 发布