Top  Previous  Next

fourier ( integer Input, integer Output, integer Mode [, integer FFT =1 ] )

Use this function to convert a grayscale image from the spatial domain into the frequency domain and vice versa, by applying the forward and inverse Fourier transform.

The discrete 2D Fourier transform is defined by the following equation:

where N is the horizontal size of the image or selection in pixels, M is the vertical size. The resulting image F is a complex image each pixel of which represents the amplitude and phase of a certain frequency. Different distances of pixels from the origin (the center of the image) represent different spectral frequencies, different directions represent different orientations in the original image, and the amplitude value at each locations shows how much of that frequency and orientations is present in the original image. The farther from the center of the image the pixel is, the higher spatial frequency it represents.

The inverse Fourier transform converts a frequency image back to the spatial domain:


Computing the discrete Fourier transform require a great deal of processing power, but if
N and M are powers of 2, a fast algorithm called FFT available for computations.

An integer between 0 and 116 specifying the input image frame number. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
An enumerated integer that describes the direction of the transform:  
M_DIRECT – applies the direct Fourier transform by converting the image from the spatial domain into the frequency domain.  
M_INVERSE – applies the inverse Fourier transform by converting the image from the frequency domain into the spatial domain.  
An enumerated integer that specifies if the fast Fourier transform will be enforced. Must be one of the following values:  
FALSE – applies the DFT (discrete Fourier transform) algorithm as described above. If the horizontal and vertical sizes of the input image are powers of 2, the FFT (fast Fourier transform) algorithm will be applied.  
TRUE – applies the Fast Fourier transform algorithm for an arbitrary image size by expanding the image horizontally and vertically to the closest width and height which are powers of 2. This is done by surrounding the image with the black margins prior to the application of the function. When the inverse transform is applied to the frequency image generated with the enforced FFT algorithm, the resulting image will retain the size of the original grayscale image.  
Default value: TRUE  
Error flags

The flag set if successful.  
The flag set if failed.  

This set of statements applies converts a captured image into the frequency domain and then back to the spatial domain:  
fourier (1,2, M_DIRECT, F_FFT)  
fourier (2,3,M_INVERSE,F_FFT)