
vfft(1)                      Khoros                       vfft(1)

PROGRAM
     vfft - Computes the two dimensional Fast Fourier Transform
     (FFT)

SYNTAX
     vfft

     -i1            complex or real image

     [-i2]          imaginary image

     [-o1]          complex output image

     [-o2]          real output image

     [-o3]          imaginary output image

     [-d]           FFT direction (0 is forward, 1 is inverse)

     [-V]           Gives the version for vfft

     [-U]           Gives the usage for vfft

     [-P]           Prompts for command line options

     [-A [file1]]   Creates the answer file called vfft.ans or
                    file1

     [-a [file1]]   Uses vfft.ans or file1 as the answer file

DESCRIPTION
     vfft computes the 2 dimensional Fast Fourier Transform of an
     image.  The input image must be square and the number of
     rows (or columns) MUST be a power of two.

     This program will compute either a forward or inverse FFT,
     depending on the direction requested with the -d option.  A
     -d value of 0 or FALSE will result in a forward FFT, and a
     -d value of 1 or TRUE will result in an inverse FFT.  The
     default is a -d value of 0 or FALSE (forward FFT).

     The input arguments are described as follows:

     -i1       specifies the input image, which can be of data
               type BYTE, FLOAT or COMPLEX.  If the input image
               is of data type BYTE, then the data will first be
               converted to FLOAT before proceeding.  If the
               first input image is of type BYTE or FLOAT, then
               it is assumed that it is the real component of the
               complex pair, and the imaginary component may be
               input using the optional i2 input argument. If no
               imaginary component is specified when using a real
               input, then the imaginary component is assumed to
               be zero. If this input image is of type COMPLEX,
               then it contains both the real and imaginary com-
               ponents, and the optional input i2 will not be
               accepted.  The input image must be a single band
               image, with map type OPTIONAL.

     -i2       specifies the optional input image, which can be
               of data type BYTE or FLOAT.  It is assumed that
               this image represents the imaginary component of
               the complex pair.

     -o1       specifies the complex output image, which will be
               a single band image of data type COMPLEX.  This
               image contains both the real and imaginary com-
               ponents.

     -o2       specifies the real output image, which will be a
               single band image of data type FLOAT.  This image
               contains only the real component of the complex
               pair.

     -o3       specifies the imaginary output image, which will
               be a single band image of data type FLOAT.  This
               image contains only the imaginary component of the
               complex pair.

     -d        is an OPTIONAL input, which specifies the FFT
               direction.  A -d of 0 or FALSE will result in a
               forward FFT, and a -d of 1 or TRUE will result in
               an inverse FFT.  The default is -d of 0 or FALSE
               specifiying a forward FFT.

     If the first input image (required input) is of data type
     COMPLEX, then both the real and imaginary parts of the data
     are present, however if the data type of this image is BYTE
     or FLOAT, then it is assumed that this image represents only
     the real part of the data.  The imaginary part of the com-
     plex pair may be input as the optional second input image.
     If the first input image is of type BYTE or FLOAT, and the
     second (optional) input image is not specified, then it is
     assumed that the imaginary component is zero.

     At least one output image must be selected or specified for
     the program to continue.

     Note that it is the users responsibility to ensure that the
     correct components of the image are used when requesting an
     FFT or Inverse FFT.  Unexpected results may occur if the
     user requests an inverse FFT and only inputs the real com-
     ponent of an image.  If an FFT of an image is taken, then
     both the real and imaginary components must be used to
     obtain a correct inverse FFT.

     For a forward FFT, the input data is multiplied by (-
     1)**(x+y) where (x,y) is the pixel coordinate. This has the
     effect of shifting the frequency domain result so that the
     DC component is at (N/2,N/2) rather than (0,0). For the
     inverse FFT case, the data is multiplied by (-1)**(x+y)
     AFTER the FFT processing, accounting for the fact that the
     input frequency domain data was center-shifted by the for-
     ward FFT. The center-shifted frequency domain representation
     is much easier to visualize and filter than it would be if
     not shifted. For more information on the shifting teqch-
     nique, see R.C. Gonsalez and P. Wintz, "Digital Image Pro-
     cessing, 2nd ed, sec 3.2.2, p. 77. (1987). The center-
     shifting should really be an option.

     For the forward FFT, there is no scaling on the data. For
     the inverse FFT, the data is scaled by 1/(N*N). Thus, to
     generate a sinewave of amplitude 1.0 for a 64x64 complex
     image to be handed to the inverse FFT, there should be two
     impulses at conjugate locations (symmetric about the center
     of the image) each with amplitude 0.5/(64*64). Why 0.5? It's
     because each impulse carries half of the power! The scaling
     should really be an option, but it currently is not (perhaps
     in a future patch).

REQUIRED ARGUMENTS
     -i1    type: infile
            desc: complex or real image

OPTIONAL ARGUMENTS
     -i2    type: infile
            desc: imaginary image

     -o1    type: outfile
            desc: complex output image

     -o2    type: outfile
            desc: real output image

     -o3    type: outfile
            desc: imaginary output image

     -d     type: boolean
            desc: FFT direction (0 is forward, 1 is inverse)
            default: false

EXAMPLES
     vfft -i1 feath.cmplx -o1 feath.fft.cmplx

     obtains the FFT of image "feath.cmplx".  The resulting out-
     put image will be of type COMPLEX, containing both com-
     ponents of the FFT.  The -d option is 0 resulting in a for-
     ward FFT.

     vfft-i1 feath.cmplx -o2 feath.fft.real -o3 feath.fft.imag

     obtains the forward FFT of image "feath.cmplx".  The result-
     ing output images will be of type FLOAT.  The image
     "feath.fft.real" contains the real component of the
     transformed image, and the image "feath.fft.imag" contains
     the imaginary component of the transformed image.  The -d
     option is 0 resulting in a forward FFT.

     vfft -i1 feath.real -i2 feath.imag -o1 feath.fft.cpmlx

     obtains the forward FFT of image "feath.real and
     feath.imag".  Both the real and imaginary parts are speci-
     fied as input to the FFT routine.  The output image will
     contain both the real and imaginary components of the
     transformed image, and is stored as data type COMPLEX.

     vfft -i1 feath.fft.cmplx -o1 feath.cmplx -d 1

     obtains the inverse FFT of image "feath.fft.cmplx".  The
     input image is of data storage type COMPLEX, and contains
     both the real and imaginary components of the transformed
     image.  The output contains both the real and imaginary com-
     ponents which comprise the original image resulting from the
     inverse transform.

SEE ALSO
     intro(1), verror(3), vgparms(3), vutils(3), lvfft(3)
     vfft(1),vlpf(1),vctor(1),vrtoc(1),lvcast(3)

RESTRICTIONS
     vfft will only work on single band images of data type BYTE,
     FLOAT or COMPLEX.

COPYRIGHT
     Copyright 1991, University of New Mexico.  All rights
     reserved.

Khoros                    Release: 1.0                          1

