资源描述:
《基于小波变换的医学超声图像去噪方法研究程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、I=imread('xian.bmp');subplot(2,2,1);imshow(I);title('原始图像');>>if~isempty(size(I,3))y=rgb2gray(I);end>>subplot(2,2,2);>>imshow(y);>>title('原始灰度图像');>>J=imnoise(y,'speckle');>>subplot(2,2,3);>>imshow(J);>>title('加噪后的图像');>>J=double(J);>>A=log(1+J);>>subplot(2,2,4);>>imshow(A,[]);>>title('对数变换后
2、的图像');I=imread('xian.bmp');if~isempty(size(I,3))y=rgb2gray(I);endsubplot(2,2,1);imshow(y);title('原始灰度图像');J=imnoise(y,'speckle');subplot(2,2,2);imshow(J);title('加噪后的图像');[m,n]=size(J);J=double(J);k1=filter2(fspecial('average',3),J)/255;%3*3均值滤波k2=filter2(fspecial('average',7),J)/255;%7*7均值滤波
3、subplot(2,2,3);imshow(k1,[]);title('3*3均值滤波');subplot(2,2,4);imshow(k2,[]);title('7*7均值滤波');[PSNR1,MSE1]=psnr(y,k1);[PSNR2,MSE2]=psnr(y,k2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2MSE1:MSE1=1.0948e+004PSNR1:PSNR1=7.7376MSE2:MSE2=1.0948e+004PSNR
4、2:PSNR2=7.7373I=imread('xian.bmp');if~isempty(size(I,3))y=rgb2gray(I);endsubplot(2,2,1);imshow(y);title('原始灰度图像');J=imnoise(y,'speckle');subplot(2,2,2);imshow(J);title('加噪后的图像');[m,n]=size(J);J=double(J);x1=medfilt2(J,[33]);%3*3中值滤波x2=medfilt2(J,[77]);%7*7中值滤波subplot(2,2,3);imshow(x1,[]);tit
5、le('3*3中值滤波');subplot(2,2,4);imshow(x2,[]);title('7*7中值滤波');[PSNR1,MSE1]=psnr(y,x1);[PSNR2,MSE2]=psnr(y,x2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2MSE1:MSE1=156.7310PSNR1:PSNR1=26.1793MSE2:MSE2=99.1610PSNR2:PSNR2=28.1674closeall;clcI=imread('x
6、ian.bmp');if~isempty(size(I,3))y=rgb2gray(I);endJ=imnoise(y,'speckle');[m,n]=size(J);J=double(J);c1=wiener2(J,[33]);%3*3维纳滤波c2=wiener2(J,[77]);%7*7维纳滤波figure;subplot(2,2,1);imshow(y,[]);title('原始灰度图像');subplot(2,2,2);imshow(J,[]);title('加噪后的图像');subplot(2,2,3);imshow(c1,[]);title('3*3维纳滤波');
7、subplot(2,2,4);imshow(c2,[]);title('7*7维纳滤波');[PSNR1,MSE1]=psnr(y,c1);[PSNR2,MSE2]=psnr(y,c2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2MSE1:MSE1=118.0365PSNR1:PSNR1=27.4106MSE2:MSE2=88.1850PSNR2:PSNR2=