⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recover.m

📁 图像复原逆滤波法matlab实现 和增强比较。
💻 M
字号:
close all;clear;clc;
I=imread('D:\fjptmzd.jpg');
subplot(2,2,1),imshow(I);
title('原始图像');
LEN=40;THETA=30;
PSF=fspecial('motion',LEN,THETA);
Blurredmotion=imfilter(I,PSF,'circular','conv');
imwrite(Blurredmotion,'moved.bmp');
subplot(2,2,2),imshow(Blurredmotion);
title('运动模糊的图像');
wnr1=deconvwnr(Blurredmotion,PSF);
imwrite(wnr1,'recover.bmp');
subplot(2,2,3),imshow(wnr1);
title('理想复原图像');
sz(3)=1;sz=size(wnr1);
A=reshape(wnr1,[sz(1),sz(2)*sz(3)]);
K=im2double(A);
T=dctmtx(8);
B=blkproc(K,[8,8],'P1*x*P2',T,T);
Mask=[1 1 1 2 2 2 3 3
      1 1 2 2 2 3 3 3
      1 2 2 2 3 3 3 4
      2 2 2 3 3 3 4 4
      2 2 3 3 3 4 4 4
      2 3 3 3 4 4 4 4
      3 3 3 4 4 4 4 5
      3 3 4 4 4 4 5 5];
  B2=blkproc(B,[8,8],'P1.*x',Mask);
  I2=blkproc(B,[8,8],'P1.*x*P2',T,T);
  %[K noise]=wiener2(A,[5,5]);
  B3=reshape(I2,sz);
  subplot(2,2,4),imshow(uint8(60*B3));
  imwrite(B3,'增强.bmp');
  title('增强');
  wnr2=deconvwnr(Blurredmotion,fspecial('motion',1.1*LEN,THETA));
  figure;subplot(1,2,1),imshow(wnr2);title('1.1倍的实际位移复原图像');
   wnr3=deconvwnr(Blurredmotion,fspecial('motion',1.5*LEN,THETA));
  figure;subplot(1,2,2),imshow(wnr3);title('1.5倍的实际位移复原图像');

⌨️ 快捷键说明

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