# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# 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.

 Note:   Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## 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

## Methods

 clone Create FFT object with same property values getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes step Compute 2D discrete Fourier transform of input

## Examples

expand all

Visualize original image and its FFT magnitude response.

Create the FFT object.

```fftObj = vision.FFT; ```

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

Compute the FFT.

```J = 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

[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.