1
$\begingroup$

I am doing a fairly simple homework assignment in MATLAB that is to filter an image in the frequency domain. So my code looks something like this:

output = ifft2(fft2(image, x, y).*fft2(filter, x, y));

After testing some images, this code filters properly, but has weird edge behavior. Out of curiosity, what exactly happens at the edges using this method? (0, symmetric, replicate, circular)?

$\endgroup$
1
  • $\begingroup$ Please add the homework tag, and try adding an image illustrating the weird behavior in your result. $\endgroup$
    – Gilles
    Sep 30, 2015 at 9:27

1 Answer 1

1
$\begingroup$

Quick answer: FFT2 assumes periodic boundary conditions. This means that performing the FFT2 of an image is equivalent to have your original image periodically repeated in the horizontal and vertical directions, compute the DFT, and then only retain the central region. The weird artifacts you are seeing are probably the result of juxtaposing opposite edges that are not related to each other.

There are ways to work around this by, e.g., smoothing these discontinuities by using MATLAB’s edgetaper function before filtering.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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