I'm working to restore a blurred image without knowing the PSF value. I used blind deconvolution to estimate the PSF value and Lucy Richardson method to completely restore the image. The thing is, I used fspecial('gaussian')
to blur the image and now I need to use imgaussfilt
function to do that. But once I do that, the image does not restore as expected. With the first method, I got excellent results.
What is the difference between fspecial('gaussian')
and imgaussfilt()
? Is there a way I can restore an image blurred with the second function?
PS: All the images are iris pictures used in a biometric system.
First I tried the restoration process using this code:
function [J, P, V] = blindDeconv(image, qualityBlur, upTo)
lowerValue = 20;
for i = 3:15
for j = 1:upTo
P = fspecial('gaussian', i, j);
[I PSF] = deconvblind(image,P);
%[I PSF] = deblur(image, j);
quality = blurMetric(I);
if quality < lowerValue
lowerValue = quality;
P = PSF;
J = I;
V = j;
end
end
end
And this is the main script where I blur and deblur the image:
%----------------------
% Blurring process
%----------------------
%PSF = fspecial('gaussian', 7, j);
%blur{i,j} = imfilter(im2double(image{i}), PSF, 'conv');
blur{i,j} = imgaussfilt(im2double(image{i}), j);
qualityBlur{i, j} = blurMetric(blur{i, j});
link = strcat(folder, '/', prefix, '_blur_', num2str(j), '.jpeg');
imwrite(blur{i, j}, link, 'jpeg');
%---------------------
% Deblurring process
%----------------------
[J, P, V] = blindDeconv(blur{i, j}, qualityBlur{i, j}, upTo);
deblurred{i, j} = deconvlucy(J, P, 20, V);
qualityDeblurred{i, j} = blurMetric(deblurred{i, j});
link = strcat(folder, '/', prefix, '_deblur_', num2str(j), '.jpeg');
imwrite(deblurred{i, j}, link, 'jpeg');
Image sample: