What should be the input and output for converting an FFT image?

I am trying to get a grayscale spectrum using the Cooley-Tukey FFT algorithm in Java. I do not know exactly how to form the input for the algorithm and which values ​​from the result to use to form the spectrum image.

Currently my input is an array of complex numbers, with Re = pixel value in 8-bit grayscale and Im = 0; After starting the algorithm, I get another array of complex numbers with the real part, which has many values ​​from the range [0.255] and the imaginary part 0. I tried to create an image from an array of real numbers modulo 256.

Here's what the spectrum should look like: enter image description here

And here is what I have:

enter image description here

Obviously I'm doing something terrible, but I don't know what.

0
source share
1 answer

You did not specify your source code ...

  • your result looks like a permission tree

    used to recursively scale resolution / frequency information and extract the FFT function !!! So maybe your recursion is incorrect or you overlap the data (so that the code at the FFT location is almost madness), you should start with 1D conversion and then use it for 2D and visually check each step (also the inverse transformation according to the original data)

  • your FFT output must have a nonzero imaginary part !!!

  • - 2?

    , FFT

  • :

    2D FFT example

    • left - ( )
    • -
    • right -

    =sqrt(Re*Re+Im*Im), Re Im , , . :

    more examples

    ( , ).

[Edit1] power and wrap

power wrap , :

power and wrap result

intensity=sqrt(Re^2+Im^2), . , , , swap((x,y),(x+xs/2,y)) swap((x,y),(x,y+ys/2)). OP,

+2

All Articles