image_smooth.m

来自「原创:在matlab里仿真有关图像的一些数字处理技术」· M 代码 · 共 44 行

M
44
字号
load woman;                          %装入原图
X1=X;
map1=map;
subplot(221);
image(X1);
colormap(map1);
title('woman');
axis square                               %画出原图
             
[c,s]=wavedec2(X,2,’sym4’);                               %二层分解小波信号
sizec=size( c );            
for I= 1:sizec(2)            %频域里增强图像
     if(c( I )>350)
       c( I )=1.3*c( I );
     else
       d( I )=0.5*c( I );
     end
end
xx=waverec(c,s,’sym4’);        %系数重构
init=2788605826;           %加入噪声
rand(‘seed’,init);
xx=xx+68*(rand(size(xx)));
subplot(221);image(xx);
title(‘增强的含噪图象‘);
axis square;
for I=2:1:255              %中值滤波
   for j=2:1:255
      temp=0;
for m=1:3
  for n=1:3
       temp=temp+xx(I+m-2,j+n-2);
  end
end
temp=temp/9;
xx(I, j)=temp;
end
end
colormap(map);
subplot(222);
image(xx);
axis square;
title(‘平滑后的图象‘);
axis square                               %画出平滑后图像

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?