声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1247|回复: 0

[小波] matlab小波分析在图像消噪中的应用实例

[复制链接]
发表于 2016-4-5 16:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
  例一:利用小波分析给定一个二维含噪图像进行消噪处理
  源程序如下:
  1.   clear all; %清楚所有变量

  2.   RGB=imread('5.bmp'); %读取MATLAB目录下的测试图片 名为:5.bmp

  3.   [x,map]=rgb2ind(RGB,128); %把真彩色图像RGB转换为索引图像

  4.   subplot(2,2,1);

  5.   image(x);

  6.   colormap(map);

  7.   title('原始的图像');

  8.   init=2055615866; %加入噪声

  9.   rand('seed',init);

  10.   X=double(x);

  11.   XX=X+randn(size(x))/10;

  12.   subplot(2,2,2);

  13.   image(XX);

  14.   colormap(map);

  15.   title('含噪声的图像');

  16.   [c,l]=wavedec2(XX,2,'sym5'); %进行小波分析

  17.   a1=wrcoef2('a',c,l,'sym5',1);

  18.   a2=wrcoef2('a',c,l,'sym5',2);

  19.   subplot(2,2,3);

  20.   image(a1);

  21.   colormap(map);

  22.   title('第一层的重构图像');

  23.   subplot(2,2,4);

  24.   image(a2);

  25.   colormap(map);

  26.   title('第二层的重构图像');
复制代码
  试验结果的图片:


  例一:利用小波分析给定一个二维含噪图像进行消噪处理例二:利用二维小波变换给定图像进行小波消噪处理

  例二:利用二维小波变换给定图像进行小波消噪处理
  1.   clear all

  2.   RGB=imread('5.bmp');

  3.   [x,map]=rgb2ind(RGB,128);

  4.   subplot(2,2,1);

  5.   image(x);

  6.   colormap(map);

  7.   title('原始图像');

  8.   init=2055615866;

  9.   rand('seed',init);

  10.   X=double(x);

  11.   XX=X+randn(size(x))/10;

  12.   subplot(2,2,2);

  13.   image(XX);

  14.   colormap(map);

  15.   title('含噪图像');

  16.   [c,l]=wavedec2(XX,3,'coif2');

  17.   n=[1,2];

  18.   p=[10.28,24.08];

  19.   %nc=wthcoef2('h',c,l,n,p,'s');

  20.   %nc=wthcoef2('v',c,l,n,p,'s');

  21.   nc=wthcoef2('d',c,l,n,p,'s');

  22.   X1=waverec2(nc,l,'coif2');

  23.   subplot(2,2,3);

  24.   image(X1);

  25.   colormap(map);

  26.   %mc=wthcoef2('h',nc,l,n,p,'s');

  27.   mc=wthcoef2('v',nc,l,n,p,'s');

  28.   %mc=wthcoef2('d',nc,l,n,p,'s');

  29.   X2=waverec2(mc,l,'coif2');

  30.   subplot(2,2,4);

  31.   image(X2);

  32.   colormap(map);

  33.   title('第二次消噪后的图像');
复制代码


转自:http://www.zhixing123.cn/matlab/23150.html

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-16 15:31 , Processed in 0.207661 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表