how to deblur an image?

11 Ansichten (letzte 30 Tage)
jagannath mishra
jagannath mishra am 9 Mai 2013
sir,i have an image and pass it through the Gaussian low pass filtering(fft2). As an output i got an image which is very much blur.now how can i remove this blurring effect from my image.i have used the "Deblurring Images Using a Regularized Filter", which is given in "demo of the matlab" but the output is not correct. Please tell me the code for deblurring the image.
This is the original : http://tinypic.com/r/33v2m9w/5,
This is the filtered http://tinypic.com/r/16hozg0/5
and this is the output after debluring it: http://tinypic.com/r/2wn0biv/5.

Antworten (2)

Image Analyst
Image Analyst am 9 Mai 2013
Nevermind (yet) about deblurring - you don't even have the blurred version correct. However without your code, I can't do much, and I don't want to go searching through dozens of demos to try to figure out which one you used.
  1 Kommentar
jagannath mishra
jagannath mishra am 10 Mai 2013
Bearbeitet: jagannath mishra am 10 Mai 2013
% code
close all
clear all
clc
im=imread('jm.jpg');
%im=imresize(im,[300 300]);
im=rgb2gray(im);
fc=100;
imf= fftshift(fft2(im));
[co,ro]=size(im);
out = zeros(co,ro);
cx = round(co/2);
cy = round(ro/2);
H = zeros(co,ro);
%H=imresize(H,[200 200]);
for i = 1 : co
for j = 1 : ro
d = (i-cx).^2 + (j-cy).^2;
H(i,j) = exp(-d/2/fc/fc);
end;
end;
outf= imf.*H;
out=abs(ifft2(outf));
imshow(im);
title('original image');
out=int8(out);
figure
imshow(out);
%title('gaussian lowpass filtered image');
figure
imshow(H);
title('2D view of H');
%figure
%surf (H),title('3d view of H')
%debluring starts from here%
out=single(out);
PSF=fspecial('gaussian',11,5);%point spread function%
[reg1 LAGRA]=deconvreg(out,PSF);
figure
imshow(reg1);
title('deblured image');
this is the entire code i used for lpf and debluring.please correct me if i was wrong.thanks in advance."fc" can be taken as convinience

Melden Sie sich an, um zu kommentieren.


Bjorn Gustavsson
Bjorn Gustavsson am 10 Mai 2013
Bearbeitet: Bjorn Gustavsson am 10 Mai 2013
  1. You've forgotten an fftshift - that should be done once more.
  2. The widths of your filter and PSF should match (in a perfect world) or preferably the PSF you deblur with should be a bit narrower than the PSF of the filter (you have to work out how they are related and how to fix that.)
  3. Pure deconvolution is a process that will amplify noise - that's why you have all these damping terms and more complex methods. If you try to deconvolve with a wider PSF than what you used in the filter then this will be very difficult to avoid.
HTH
  3 Kommentare
Bjorn Gustavsson
Bjorn Gustavsson am 10 Mai 2013
  1. Step through your code line by line, make sure you understand why you did the fftshift where you did it, then you'll be able to see where you should do the ifftshift rather naturally.
  2. The PSF and the filter-kernel in the fourier domain are an Fourier transform pair.
HTH
Image Analyst
Image Analyst am 10 Mai 2013
Did you get it solved yet? I was going to take a look at it but it's been so long that I suspect you've already solved it and I don't want to waste my time.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by