Hello,

I’ve successfully performed a FFT then iFFT on a 2D histogram as per:

Thanks John!

Now I would like to implement the ability to cut out selected frequencies. This was simple in the 1D case, where each element of the real and imaginary coefficient arrays are simply the coefficients of the corresponding frequency, when you use GetPointsComplex(double *re, double *im). Then you can make the desired cut by setting the corresponding array element to 0, and performing the backward transform on the modified array.

In the 2D case, however, I can’t figure out how the arrays correspond to frequency. Plotting the magnitude histogram, as outputed by the FFT function, makes sense, with a point (delta function) in 2D space corresponding to the frequency of the sine wave(s). But I can’t seem to recreate this histogram using the real and imaginary coefficient arrays. In other words, I don’t know how the arrays are filled so I can’t make a specific frequency cut.

I’ve attached my script which creates a 2D histogram using a sine function. It draws the image, the magnitude histogram (as output by ->FFT), and the real/imaginary/magnitude arrays as I have filled them (which may be incorrect). Finally, the unmodified coefficients are used to perform the iFFT and the resulting image is drawn (which is the same as the original image as expected).

Can anyone help me determine how the coefficient arrays are defined for the 2D FFT (how do they correspond to real frequencies) so that I can cut out frequencies from x and/or y?

Thank you,

Patrick

2DFFTCut.c (3.44 KB)