Function fft2d::slice::fft_2d

source ·
pub fn fft_2d(width: usize, height: usize, img_buffer: &mut [Complex<f64>])
Expand description

Compute the 2D Fourier transform of an image buffer.

The image buffer is considered to be stored in row major order. After the 2D FFT has been applied, the buffer contains the transposed of the Fourier transform since one transposition is needed to process the columns of the image buffer.

The transformation is not normalized. To normalize the output, you should multiply it by 1 / sqrt( width * height ). If the transformed buffer is intended to be processed and then converted back into an image with an inverse Fourier transform, it is more efficient to multiply at the end by 1 / (width * height).

Remark: an allocation the size of the image buffer is performed for the transposition, as well as scratch buffers while performing the rows and columns FFTs.