4
$\begingroup$

I am trying to implement the constrained least squares filtering as described in Rafael C. Gonzalez, Richard E. Woods - Digital Image Processing 3rd Edition Section 5.9. The equation (5.9-4) says that $ P \left( u, v \right) $ is the Fourier transformation of the Laplacian filter ($ 3 x 3 $). But the coordinates $u$, $v$ are the coordinates of the image which is much greater than 3x3.

How can I implement this 2D Filter in Frequency Domain?

enter image description here

$\endgroup$
  • $\begingroup$ Could you link to the reference? $\endgroup$ – Royi Nov 7 '20 at 8:43
  • $\begingroup$ So it's the book Rafael Gonzalez et.al 'Digital image processing 2007, chapter 5.9 p.380 in that edition of the book $\endgroup$ – Maciek Woźniak Nov 7 '20 at 18:28
  • $\begingroup$ Could you post more context about the problem being solved and then I will be able to solve it for you? $\endgroup$ – Royi Nov 8 '20 at 6:01
  • $\begingroup$ Do you want me to solve it? $\endgroup$ – Royi Nov 9 '20 at 5:06
  • $\begingroup$ Hi i manage to solve it. Mainly the case is that the filter had to be shifted to the midle of the image and then padded to the size of image. In Matlab fft2(fftshift(o,d1,d2)) where d1 and d2 are dimensions of the img $\endgroup$ – Maciek Woźniak Nov 10 '20 at 6:12
4
$\begingroup$

When dealing with applying a 2D convolution in frequency domain we have to take into account 2 things:

  1. Extending the kernel to the dimension of the input data.
  2. Dealing with the implicit periodic extension of the frequency domain element wise multiplication.

As you wrote in the comments, one way to do it is simple zero padding and fftshift(). Yet this might cause some artifacts.

Better way to deal with it is the Periodic Extension as I wrote in my answer to Applying 2D Image Convolution in Frequency Domain with Replicate Border Conditions in MATLAB. I added there some code to apply the extension in MATLAB.

More sources would be Applying Image Filtering (Circular Convolution) in Frequency Domain and my answer to How to Zero Pad in Order to Perform Filtering in the Fourier (Frequency) Domain? and 2D Frequency Domain Convolution Using FFT (Convolution Theorem).

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.