Documentation

vision.FFT System object

Package: vision

Two-dimensional discrete Fourier transform

Description

The vision.FFT object computes the 2D discrete Fourier transform (DFT) of a two-dimensional input matrix.

Construction

fftObj = vision.FFT returns a 2D FFT object, fftObj, that computes the fast Fourier transform of a two-dimensional input.

fftObj = vision.FFT(Name,Value) configures the System object properties, specified as one or more name-value pair arguments. Unspecified properties have default values.

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation.
Code Generation Support, Usage Notes, and Limitations.

To compute FFT:

  1. Define and set up your FFT object using the constructor.

  2. Call the step method with the input image, I and the FFT object, fftObj. See the syntax below for using the step method.

J = step(fftObj,I) computes the 2-D FFT, J, of an M-by-N input matrix I, where M and N specify the dimensions of the input. The dimensions M and N must be positive integer powers of two when any of the following are true:

The input is a fixed-point data type
You set the BitReversedOutput property to true.
You set the FFTImplementation property to Radix-2.

Properties

FFTImplementation

FFT implementation

Specify the implementation used for the FFT as one of Auto | Radix-2 | FFTW. When you set this property to Radix-2, the FFT length must be a power of two.

Default: Auto

BitReversedOutput

Output in bit-reversed order relative to input

Designates the order of output channel elements relative to the order of input elements. Set this property to true to output the frequency indices in bit-reversed order.

Default: false

Normalize

Divide butterfly outputs by two

Set this property to true if the output of the FFT should be divided by the FFT length. This option is useful when you want the output of the FFT to stay in the same amplitude range as its input. This is particularly useful when working with fixed-point data types.

Default: false with no scaling

 Fixed-Point Properties

Methods

cloneCreate FFT object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
stepCompute 2D discrete Fourier transform of input

Examples

expand all

Use 2-D FFT to View the Frequency Components of an Image

Create the FFT object.

fftObj = vision.FFT;

Read the image.

I = im2single(imread('pout.tif'));

Compute the FFT.

J = step(fftObj, I);

Shift zero-frequency components to the center of spectrum.

J_shifted = fftshift(J);

Display original image and visualize its FFT magnitude response.

figure; imshow(I); title('Input image, I'); 
figure; imshow(log(max(abs(J_shifted), 1e-6)),[]), colormap(jet(64));
title('Magnitude of the FFT of I');

References

[1] FFTW (http://www.fftw.org)

[2] Frigo, M. and S. G. Johnson, "FFTW: An Adaptive Software Architecture for the FFT,"Proceedings of the International Conference on Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 1381-1384.

Was this topic helpful?