基于小波变换的医学超声图像去噪方法研究程序_第1页
基于小波变换的医学超声图像去噪方法研究程序_第2页
基于小波变换的医学超声图像去噪方法研究程序_第3页
基于小波变换的医学超声图像去噪方法研究程序_第4页
基于小波变换的医学超声图像去噪方法研究程序_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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('

2、;加噪后的图像');>> J=double(J);>> A=log(1+J);>> subplot(2,2,4);>> imshow(A,);>> title('对数变换后的图像');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);imsh

3、ow(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均值滤波subplot(2,2,3);imshow(k1, );title('3*3均值滤波');subplot(2,2,4);imshow(k2, );title('7*7均值滤波');PSNR1, MSE1 = psnr(y, k1);PS

4、NR2, MSE2 = psnr(y, k2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2MSE1:MSE1 = 1.0948e+004PSNR1:PSNR1 = 7.7376MSE2:MSE2 = 1.0948e+004PSNR2:PSNR2 = 7.7373I=imread('xian.bmp'); if isempty(size(I,3)y=rgb2gray(I);endsub

5、plot(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,3 3);%3*3中值滤波x2=medfilt2(J,7 7);%7*7中值滤波subplot(2,2,3);imshow(x1, );title('3*3中值滤波');subplot(2,2,4);imshow(x2,);title('7*7中值

6、滤波');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.1674close all;clcI=imread('xian.bmp

7、9;); if isempty(size(I,3)y=rgb2gray(I);endJ=imnoise(y,'speckle');m,n=size(J);J=double(J);c1=wiener2(J,3 3);%3*3维纳滤波c2=wiener2(J,7 7);%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

8、维纳滤波');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.1850PSNR

9、2:PSNR2 = 28.6769close all;clc; 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('加噪后的图像');c,l=wavedec2(J,2,'sym4');>> a1=uint8(wrcoef2('a',c

10、,l,'coif2',2);>> gc,gl=wavedec2(a1,2,'coif2');>> n=1,2;%设置尺度向量>> p=10.28,24.08;%设置阈值向量>> nc=wthcoef2('h',gc,gl,n,p,'s');>> nc=wthcoef2('v',gc,gl,n,p,'s');>> nc=wthcoef2('d',gc,gl,n,p,'s');>> mc=

11、wthcoef2('h',gc,gl,n,p,'s');>> mc=wthcoef2('v',gc,gl,n,p,'s');>> mc=wthcoef2('d',gc,gl,n,p,'s');>> d1=waverec2(nc,gl,'coif2');>> subplot(2,2,3);>> imshow (x1,);title('第一次消噪图像');d2=waverec2(mc,gl,'coif2&

12、#39;);>> subplot(2,2,4);>> imshow (x2, );>> title('第二次消噪图像');PSNR1, MSE1 = psnr(y, x1);PSNR2, MSE2 = psnr(y, x2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2MSE1:MSE1:MSE1 = 156.7310PSNR1:PSNR1 = 26

13、.1793MSE2:MSE2 = 99.1610PSNR2:PSNR2 = 28.1674close all;clcI=imread('xian.bmp'); if isempty(size(I,3)y=rgb2gray(I);endJ=imnoise(y,'speckle'); m,n=size(J);J=double(J);A=log(1+J);THR=thselect(A, 'heursure');c,l=wavedec2(A,2, 'coif2');a1=wrcoef2('a',c,l,'coif2

14、',2);gc,gl=wavedec2(a1,2,'coif2');n=1,2;%设置尺度向量p=THR,THR;%设置阈值向量nc=wthcoef2('h',gc,gl,n,p,'s');nc=wthcoef2('v',gc,gl,n,p,'s');nc=wthcoef2('d',gc,gl,n,p,'s');mc=wthcoef2('h',nc,gl,n,p,'s');mc=wthcoef2('v',nc,gl,n,p,&#

15、39;s');mc=wthcoef2('d',nc,gl,n,p,'s');e1=waverec2(nc,gl,'coif2');E1=exp(e1)-1;e2=waverec2(mc,gl,'coif2');E2=exp(e2)-1;figure;subplot(2,2,1);imshow(y, );title('原始灰度图像');subplot(2,2,2);imshow(J, );title('加噪后的图像');subplot(2,2,3);imshow (E1,);title(

16、9;改进后第一次消噪图像');subplot(2,2,4);imshow (E2, );title('改进后第二次消噪图像');PSNR1, MSE1 = psnr(y, E1);PSNR2, MSE2 = psnr(y, E2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2MSE1:MSE1 = 84.9459PSNR1:PSNR1 = 28.8394MSE2:MSE2 =

17、84.9459PSNR2:PSNR2 = 28.8394close all;clcI=imread('xian.bmp'); if isempty(size(I,3)y=rgb2gray(I);endJ=imnoise(y,'speckle'); 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均值滤波figure;subplot(2,2,1);im

18、show(y, );title('原始灰度图像');subplot(2,2,2);imshow(J, );title('加噪后的图像');subplot(2,2,3);imshow(k1, );title('3*3均值滤波');subplot(2,2,4);imshow(k2, );title('7*7均值滤波');b1=medfilt2(J,3 3);%3*3中值滤波b2=medfilt2(J,7 7);%7*7中值滤波figure;subplot(2,2,1);imshow(y, );title('原始灰度图像'

19、;);subplot(2,2,2);imshow(J, );title('加噪后的图像');subplot(2,2,3);imshow(b1, );title('3*3中值滤波');subplot(2,2,4);imshow(b2,);title('7*7中值滤波');c1=wiener2(J,3 3);%3*3维纳滤波c2=wiener2(J,7 7);%7*7维纳滤波figure;subplot(2,2,1);imshow(y, );title('原始灰度图像');subplot(2,2,2);imshow(J, );titl

20、e('加噪后的图像');subplot(2,2,3);imshow(c1, );title('3*3维纳滤波');subplot(2,2,4);imshow(c2, );title('7*7维纳滤波');THR=thselect(J, 'heursure');c,l=wavedec2(J,2, 'coif2');a1=uint8(wrcoef2('a',c,l,'coif2',2);gc,gl=wavedec2(a1,2,'coif2');n=1,2;%设置尺度向量p

21、=THR,THR;%设置阈值向量nc=wthcoef2('h',gc,gl,n,p,'s');nc=wthcoef2('v',gc,gl,n,p,'s');nc=wthcoef2('d',gc,gl,n,p,'s');mc=wthcoef2('h',nc,gl,n,p,'s');mc=wthcoef2('v',nc,gl,n,p,'s');mc=wthcoef2('d',nc,gl,n,p,'s');d1

22、=waverec2(nc,gl,'coif2');d2=waverec2(mc,gl,'coif2');figure;subplot(2,2,1);imshow(y, );title('原始灰度图像');subplot(2,2,2);imshow(J, );title('加噪后的图像');subplot(2,2,3);imshow (d1,);title('第一次消噪图像');subplot(2,2,4);imshow (d2, );title('第二次消噪图像');A=log(1+J);THR=t

23、hselect(A, 'heursure');c,l=wavedec2(A,2, 'coif2');a1=wrcoef2('a',c,l,'coif2',2);gc,gl=wavedec2(a1,2,'coif2');n=1,2;%设置尺度向量p=THR,THR;%设置阈值向量nc=wthcoef2('h',gc,gl,n,p,'s');nc=wthcoef2('v',gc,gl,n,p,'s');nc=wthcoef2('d',gc,

24、gl,n,p,'s');mc=wthcoef2('h',nc,gl,n,p,'s');mc=wthcoef2('v',nc,gl,n,p,'s');mc=wthcoef2('d',nc,gl,n,p,'s');e1=waverec2(nc,gl,'coif2');E1=exp(e1)-1;e2=waverec2(mc,gl,'coif2');E2=exp(e2)-1;figure;subplot(2,2,1);imshow(y, );title(

25、9;原始灰度图像');subplot(2,2,2);imshow(J, );title('加噪后的图像');subplot(2,2,3);imshow (E1,);title('改进后第一次消噪图像');subplot(2,2,4);imshow (E2, );title('改进后第二次消噪图像');PSNR1, MSE1 = psnr(y, k1);PSNR2, MSE2 = psnr(y, k2);display('MSE1:');MSE1display('PSNR1:');PSNR1display('MSE2:');MSE2display('PSNR2:');PSNR2PSNR3, MSE3 = psnr(y, b1);PSNR4, MSE4 = psnr(y, b2);display('MSE3:');MSE3display('PSNR3:');PSNR3display('MSE4:');MSE4display('PSNR4:');PSNR4PSNR5, MSE5 = psnr(y, c1);PSNR6, MSE6 = psnr(y, c2);display(

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论