How to deblur an image in frequency domain?

18 ビュー (過去 30 日間)
irem oz
irem oz 2022 年 1 月 6 日
コメント済み: Bjorn Gustavsson 2022 年 1 月 6 日
Hi, I've blurred an image by using averaging filter mask in frequency domain. Now, I want to deblur it but I keep getting a black image. Here is my code:
*1161x799 is the size of my image
I want to know why I keep getting a black image even if I use another trustworthy code.
im_gray = rgb2gray(im);
im_gray = im2double(im_gray);
%17*17 Average Filter
avgFilter = ones(17) / 289;
%Now taking FFT of both image and filter to work in frequency domain
im_fft = fft2(im_gray, 1161,799);
avgFilter_fft = fft2(avgFilter, 1161,799);
Conv = im_fft .* avgFilter_fft;
%inverse FFT
blurry_image = ifft2(Conv);
%deblur
Inv = Conv./avgFilter_fft;
deblur = ifft2(Inv);

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2022 年 1 月 6 日
Most likely you have a problem with division-by-zero in the:
Inv = Conv./avgFilter_fft;
step. If you try to set those components of Inv to zero and then proceed you might have your problem solved:
Inv = Conv./avgFilter_fft;
Inv(~isfinite(Inv(:))) = 0;
That circumvented your problem when I tested. For real cases you will obviously use some more sensible damping of the deconvolution-step, perhaps something like:
Inv = conj(avgFilter_fft).*Conv./(abs(avgFilter_fft).^2+damping_delta);
Or something more fancy depending on the wavenumber amplitudes to some power.
HTH
  2 件のコメント
irem oz
irem oz 2022 年 1 月 6 日
Thank you very much. It worked properly.
Bjorn Gustavsson
Bjorn Gustavsson 2022 年 1 月 6 日
My pleasure.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by