3
$\begingroup$

I kind of expected this to of been asked before, so if this is duplicate please point me in the right direction, however I couldn't find anything.

I am currently experimenting with low pass filtering. I take an image and apply a 2-dimensional fast Fourier transform to the image, next I apply a shift such that the zero frequency component is moved to the center (Using Matlab this is fftshift). Then I zero Fourier co-efficients which are not within some distance $r$ of the center pixel. I apply the inverse of the shift and then an inverse 2-dimensional fast Fourier transform.

Now I end up with a matrix of complex values, but to display an image I want a matrix of real values. With the matrix obtained after applying the IDFT I mapped the pixel values to their real part, imaginary part, magnitude and phase so that I could view the matrix as an image. I found that the real part and the magnitude looked like the original image and taking the imaginary part and phase rendered the image unrecognizeable compared to the original image. I also found that their wasn't a recognizable difference in quality between taking the real value of the transformed image or the absolute value.

My question is, is there advantages or disadvantages between taking the real part of absolute value after filtering (low pass, or in general)?

This is my first question on DSP.SE, so please leave comments on how to improve my question if it's not up to standard

$\endgroup$

2 Answers 2

3
$\begingroup$

If your processed 2D FFT is conjugate symmetric, then any imaginary components in the complex IFFT result are just numerical noise or rounding errors. Thus using them to compute an absolute value is mostly a waste of CPU cycles.

$\endgroup$
1
  • $\begingroup$ Am I correct in thinking that a 2D FFT of a real valued matrix will always be conjugate symmetric? So you're saying the imaginary parts are close to zero because they come from noise/errors hence the real and absolute value will be very close to equal with the absolute value being slightly greater in value? I understand that I should use the real part because it's computationally less expensive, that makes sense, thanks. $\endgroup$
    – HBeel
    Commented Apr 21, 2015 at 17:34
1
$\begingroup$

I happened to need solving the same question, so thanks for sharing this (although a while ago). However I'd like to complement or even somehow correct the accepted answer. There's a big difference between abs and real: real is a linear operator, abs is NOT. Say you want to combine 2 filters by multiplying your real-signal fft by the difference of 2 filters (e.g band-pass in frequency domain). Then you apply ifft to obtain your filtered signal. This procedure is the same as applying convolution to your physical signal. Convolution as well as fft and ifft are linear operators. If in the end you take the abs of the result, I think you're wrong because abs is not linear. You need to take the real part (I checked that). Unfortunately so far I haven't found any reference explaining this explicitly, this is my own guess.

$\endgroup$
1
  • $\begingroup$ Welcome to SE.SP! You’re correct. Remember, however, that images are non-negative: the pixels are usually between 0 and 255. While it’s possible that the low pass filter application in the OP can generate negative pixel values, mostly just taking the real part will suffice. $\endgroup$
    – Peter K.
    Commented Jun 21, 2022 at 22:16

Your Answer

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

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