Re: how to display the fft image ?

richard wrote:
just a simple question, how to display the fft result,

I got the zr(i,j) and zi(i,j), I need to apply a log fuction

to show more detail, and need a shift to make the spectrum on the

center of the image, what is the equation to to do that ?

If you mean centering - where zero frequency is at the centre of the
image, then it depends on the particular FFT. I could give you code
that would work for the Numerical recipes FFT, but that would be no use
in general.

But maybe your question is simpler. Before log, you need to take
mag(i,j) = sqrt(zr(i,j)^2 + zi(i, j)).

You might want to normalise to decibels. dB(i,j) = 20
log_{10}(mag(i,j)/magmax); magmax is the maximum magnitude and that
will map to zero with all other values mapping to <= 0.

Since you are taking logs, you can dispense with the sqrt; or, if using
dBs, make the 20 a 10.

If you want to centre, you need a mapping which will map zero row
frequency to rc = nRows/1 + 1; row freq 1 to rc +1, row freq -1 to rc
-1, etc. and the same for columns. A simple way is to centre the column
data first (iterating over rows) and then the row data (iterating over

Best regards,

Jon C.