0
$\begingroup$

I am new to image processing. Using python, I have constructed a 1D wiener filter from the power spectrum of a Noisy Image, with Noise as a function of k. They both have the same dimension which is 512 x 512. The way I construct this filter is as follows:

  • wiener1d = (NoisyImgPS-NoisyPS)/NoisyImgPS
  • This results in a 1D matrix with a size of 256. (figure1)
  • Then I construct an other 1D matrix, which is the sum of the original matrix flipped and the original 1D matrix centered at pixel freq 256 (figure2)

I want to apply this filter radially to my 2D image in the frequency space. I use meshgrid to create a radially symmetric matrix:

  • xx,yy=numpy.meshgrid(wiener1d,wiener1d)
  • r=np.sqrt(xx**2+yy*2)

then I apply it as:

  • Imagefft=np.fft.fft2(NoisyImage) (fast Fourier transform)(figure 3)
  • ImagefftShifted=np.fft.fftshift(Imagefft) (This shifts the edges to center,figure 4) figure3
  • restored=ImagefftShifted*r (Apply the filter)
  • restored=np.fft.ifftshift(restored) (Shift the middle part to back to edges)
  • restored=np.fft.ifft2(restored) (Inverse Fourier transform)
  • restored=np.real(restored) (Restored Image)

figure

As you can see from the result, the resulting image has bunch of artifacts due to the filter not being apply radially. How should I apply this filter correctly? Thank you advance for any help!

Here is location to my code(Jupyter Notebook)

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy