# Color Artifacts in Fourier Transformed Image

I am working with images and Fourier transforms. I am trying to understand what might be causing some artifacts in my output image.

I am starting with a 512x512, RGB image of Lenna. I FFT the image, and run a low-pass filter on it. Unchanged for everything inside the circle, 0 for everything outside the circle. Here is what the mask looks like:

So far so good. When I inverse FFT back to an image, I get bright green artifacts:

These look out of place to me, what might be causing them? Is it the sharp cutoff in my filter? I would have guessed that would creating ringing artifacts, but nothing like a sharp color blob. Also why green only? It's not like there's a lot of green in the original.

I'm using numpy on python 2.7.6 in 64-bit Linux, if that matters.

• could it be that your pixel channel values overflow? Aug 2, 2014 at 21:34
• Could you please provide source code for what you are doing?
– DrM
Dec 16, 2019 at 22:52

Sharp filter cutoffs (such as caused by just zeroing FFT bins) can cause ringing (look up Gibbs horns). If any ringing artifacts go outside the legal range of color values (e.g. without being clamped), they can overflow or numerically wrap and cause these bright color spot artifacts in dark areas of the image.

• That was it! Examining the actual values before converting to an image showed negative values. Apparently numpy wraps these around 255 when converting to uint8. Makes sense now, but I didn't think of it before. Aug 4, 2014 at 1:56

Some things you should keep in mind:

1. Your image is real, keep your DFT Symmetric.
2. Numerical issues might cause that after the Inverse DFT imaginary parts are lefts.
Use either abs or real to get rid of them. Most people use real() as it is a linear operation to the least.
3. One should understand what it means to "Zero" out by mask DFT values.
It is not the "Ideal LPF". It causes Ringing / Halos due to Gibbs Phenomenon. One should use better designed LPF.

I hope it helps.