1

I have two images, one blurred and another sharp image. I need to recover the original image using these images. I have used simple FFT and inverse FFT to estimate point spread function and deblurred image.

fftorg = np.fft.fft2(img1)
fftblur = np.fft.fft2(img2)
psffft = fftblur/fftorg
psfifft = np.fft.ifftshift(np.fft.ifft2(psffft))
plt.imshow(abs(psfifft), cmap='gray')

enter image description here

This is the point spread function image I got, I need to find the type of kernel used for blurring and also its size. Is it possible to get the kernel used from PSF?

Minnie
  • 67
  • 6
  • The PSF *is* the kernel. – Cris Luengo Aug 24 '21 at 18:46
  • @CrisLuengo But how do I estimate the size of the kernel? – Minnie Aug 24 '21 at 21:04
  • Any zero pixel in the kernel is irrelevant. In `psfifft`, set to zero any pixel that is nearly zero (to avoid issues with rounding errors in the FFT and so on), then find the minimum bounding rectangle for all the non-zero pixels. That is the smallest kernel you can make. But if you make it larger, it just adds to the computational cost, it doesn't change the result of the filtering. – Cris Luengo Aug 24 '21 at 21:15
  • Also, don't use `abs(psfifft)`, but `psfifft.real`. If `img1` and `img2` are both real-valued, then `psfifft` is real-valued as well, except for rounding errors. So you can discard the imaginary part. But taking the magnitude (absolute value) like you do will change negative values to positive values, which changes the result of the filtering. – Cris Luengo Aug 24 '21 at 21:17

0 Answers0