imgcv.fftpack.fft

Functions

fft(signal)

Calculates 1D Fast Fourier Transform of a signal. It is a recursive function based on the Cooley-Tukey algorithm. Computes the DFT of a signal or array of signals in O(n log n) time.

ifft(specturm)

Calculates 1D Inverse Fast Fourier Transform of a specturm. It is a recursive function based on the Cooley-Tukey algorithm. Computes the IDFT of a specturm or array of specturms in O(n log n) time.

fft2(image)

Calculates 2D Fast Fourier Transform of an image. It is a recursive function based on the Cooley-Tukey algorithm. Computes the 2D DFT of an image or array of images in O(n^2 log n) time.

ifft2(specturm)

Calculates 2D Inverse Fast Fourier Transform of a specturm. It is a recursive function based on the Cooley-Tukey algorithm. Computes the 2D IDFT of a specturm or array of specturms in O(n^2 log n) time.

fftshift(spectrum)

Shifts the zero frequency component to the center of the spectrum.

Module Contents

imgcv.fftpack.fft.fft(signal)

Calculates 1D Fast Fourier Transform of a signal. It is a recursive function based on the Cooley-Tukey algorithm. Computes the DFT of a signal or array of signals in O(n log n) time.

NOTE: Works only for signals with length as power of 2.

Parameters:

signal (np.ndarray) – Input signal to calculate FFT.

Raises:
  • ValueError – If signal length is not power of 2.

  • ValueError – If signal is not a numpy array.

  • ValueError – If signal is not 1D.

Returns:

FFT of the input signal. The output is a complex array.

Return type:

np.ndarray

imgcv.fftpack.fft.ifft(specturm)

Calculates 1D Inverse Fast Fourier Transform of a specturm. It is a recursive function based on the Cooley-Tukey algorithm. Computes the IDFT of a specturm or array of specturms in O(n log n) time.

Parameters:

specturm (np.ndarray) – Input specturm to calculate IFFT. The input is a complex array.

Raises:
  • ValueError – If specturm is not a numpy array.

  • ValueError – If specturm is not 1D.

Returns:

IFFT of the input specturm. The output is a complex array.

Return type:

np.ndarray

imgcv.fftpack.fft.fft2(image)

Calculates 2D Fast Fourier Transform of an image. It is a recursive function based on the Cooley-Tukey algorithm. Computes the 2D DFT of an image or array of images in O(n^2 log n) time.

NOTE: Currently works only for square images and gray scale with size as power of 2.

Parameters:

image (np.ndarray) – Input image to calculate 2D FFT.

Returns:

2D FFT of the input image. The output is a complex array.

Return type:

np.ndarray

imgcv.fftpack.fft.ifft2(specturm)

Calculates 2D Inverse Fast Fourier Transform of a specturm. It is a recursive function based on the Cooley-Tukey algorithm. Computes the 2D IDFT of a specturm or array of specturms in O(n^2 log n) time.

Parameters:

specturm (np.ndarray) – Input specturm to calculate 2D IFFT. The input is a complex array.

Returns:

2D IFFT of the input specturm. The output is a complex array.

Return type:

np.ndarray

imgcv.fftpack.fft.fftshift(spectrum)

Shifts the zero frequency component to the center of the spectrum.

Parameters:

spectrum (np.ndarray) – Input spectrum to shift.

Raises:
  • ValueError – If spectrum is not a numpy array.

  • ValueError – If spectrum is not 2D.

  • ValueError – If spectrum is not square and size is not power of 2.

Returns:

Shifted spectrum.

Return type:

np.ndarray