?? recover.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 + -