www.gusucode.com > images 案例代码 matlab源码程序 > images/DeblurAnImageUsingBlindDeconvolutionExample.m

    %% Deblur an Image Using Blind Deconvolution
% 
%%
% Create a sample image with noise.
%%

% Copyright 2015 The MathWorks, Inc.

% Set the random number generator back to its default settings for
% consistency in results.
rng default;

I = checkerboard(8);
PSF = fspecial('gaussian',7,10);
V = .0001;
BlurredNoisy = imnoise(imfilter(I,PSF),'gaussian',0,V);
%% 
% Create a weight array to specify which pixels are included in processing.
%%
WT = zeros(size(I));
WT(5:end-4,5:end-4) = 1;
INITPSF = ones(size(PSF));
%%
% Perform blind deconvolution.
%%
[J P] = deconvblind(BlurredNoisy,INITPSF,20,10*sqrt(V),WT);
%%
% Display the results.
%%
subplot(221);imshow(BlurredNoisy);
title('A = Blurred and Noisy');
subplot(222);imshow(PSF,[]);
title('True PSF');
subplot(223);imshow(J);
title('Deblurred Image');
subplot(224);imshow(P,[]);
title('Recovered PSF');