数字图像处理 malab数字图像处理 matlab.docVIP

  • 25
  • 0
  • 约1.6千字
  • 约 6页
  • 2017-01-09 发布于贵州
  • 举报

数字图像处理 malab数字图像处理 matlab.doc

(1)直方图均衡 I=imread(D:\ProgramFiles\MATLAB\R2010b\toolbox\images\imdemos\trees.tif) %载入图像 J=histeq(I); %直方图均衡 subplot(2,2,1),imshow(I),title(原图); subplot(2,2,2),imhist(I),title(原图灰度直方图); subplot(2,2,3),imshow(J),title(均衡处理图); subplot(2,2,4),imhist(J),title(图均衡处理灰度直方图); (2)平滑滤波 I=imread(D:\Program Files\MATLAB\R2010b\toolbox\images\imdemos\tire.tif);%读入图像 subplot(231),imshow(I);%显示原始图像 title(原始图像);? J=imnoise(I,salt??pepper,0.01);%加均值为0,方差为0.01的椒盐噪声 ?subplot(232),imshow(J);?title(添加椒盐噪声图片);? K=medfilt2(J,[7,7]);%7X7的滤波窗口 subplot(233),imshow(K,[]);%显示处理后的图像 title(中值滤波图像);? I2=imread(D:\Program Files\MATLAB\R2010b\toolbox\images\imdemos\tire.tif); subplot(234),imshow(I2);? title(原始图像);? J2=imnoise(I2,gaussian,0.01);%加均值为0,方差为0.01的高斯噪声 subplot(235),imshow(J2);?title(添加高斯噪声图像);? K2=medfilt2(J2,[7,7]);? subplot(236),imshow(K2,[]);?title(中值滤波图像); (3)锐化滤波 I=imread(D:\Program Files\MATLAB\R2010b\toolbox\images\imdemos\tire.tif); %A=rgb2gray(I); %figure; subplot(221),imshow(I);title(原图); hs=fspecial(sobel);? S=imfilter(I,hs); hp=fspecial(prewitt); P=imfilter(I,hs); I=double(I);%双精度型 H=[0?1?0,1?-4?1,0?1?0];%拉普拉斯算子 J=conv2(I,H,same); K=I-J; subplot(222),imshow(K); title(拉普拉斯锐化图像); subplot(223),imshow(S); title(sobel算子锐化图像); subplot(224),imshow(P);? title(prewitt算子锐化图像); I=imread(D:\Program Files\MATLAB\R2010b\toolbox\images\imdemos\tire.tif); subplot(221),imshow(I);title(原图); I=double(I);%双精度型 H=[0?1?0,1?-4?1,0?1?0];%拉普拉斯算子 J=conv2(I,H,same); K=I-J; subplot(222),imshow(K); title(拉普拉斯锐化图像);

文档评论(0)

1亿VIP精品文档

相关文档