Environments | PYTHON :: EASI :: MODELER |
Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Example :: Algorithm :: References :: Related |
Back to top |
Back to top |
ftf(fili, filo, dbic, dboc, dbiw, dbow, tform)
Name | Type | Caption | Length | Value range |
---|---|---|---|---|
FILI* | str | Input file name | 1 - | |
FILO* | str | Output file name | 1 - | |
DBIC* | List[int] | Spatial domain channel | 1 - 1 | |
DBOC* | List[int] | Output frequency domain channel(s) | 1 - 2 | |
DBIW | List[int] | Raster input window | 0 - 4 | Xoffset, Yoffset, Xsize, Ysize |
DBOW | List[int] | Raster output window | 0 - 4 | Xoffset, Yoffset, Xsize, Ysize |
TFORM* | str | Transformation type | 3 - 3 | FIR | FMP | WAL | HAD | COS Default: FIR |
Back to top |
FILI
Specifies the name of the PCIDSK file from which image data is to be read.
FILO
Specifies the name of the PCIDSK file to receive the transformed data.
FILO can be the same as FILI. FILO must exist before running FTF.
DBIC
Specifies the input spatial domain channel to be transformed to the frequency domain. Complex-valued input channels are supported.
DBOC
Specifies the output channel(s) to receive the frequency domain channel(s); that is, the 2-D frequency spectrum of the input raster channel.
It is recommended that real-valued input images have their Fourier transforms stored in real-valued output channels, while complex-valued images have their Fourier transforms stored in complex output channels. This ensures that if the frequency images are subsequently filtered in the frequency domain by the FFREQ module with the help of bitmaps, they are processed correctly. Specifically, the bitmaps are symmetrized for real-valued transforms, but used as-is for complex-valued transforms.
DBIW
Specifies the raster window (Xoffset, Yoffset, Xsize, Ysize) that is read from the input image. If this parameter is not specified, the entire image is processed by default.
Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.
DBOW
Specifies the raster window (Xoffset, Yoffset, Xsize, Ysize) in the output channel in which to place the transformed image. If this parameter is not specified, the entire channel is output by default.
Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.
The window size (Xsize, Ysize) must be a power of 2 and define an area at least as large as the input window size (DBIW).
TFORM
Specifies the type of transformation to perform.
Back to top |
Transforming images into the frequency domain is useful for a variety of image processing operations (such as noise elimination and spatial filtering). FTF can be used to perform almost any type of filtering, provided that the user understands how each component of the Fourier (or other transformation) spectrum relates back to the original image.
For Fourier transformations (FIR or FMP), the input channel may contain either a complex-valued image, for example a single-look complex SAR image, or a real- or integer-valued image, such as a detected SAR image, or an optical satellite image. The output transform must be stored as 32-bit floating point values, either in a single complex channel, or in two real-valued channels. If a complex channel is used for output, the format is reset to FIR (real and imaginary values). For the COS, HAD and WAL transformations, one real- or integer-valued channel is required for input, and one 32-bit floating point channel is used for output.
For Fourier transformations, the zero frequency (DC component) is in the center of the transform image and progressively higher frequencies are plotted radially outward. For Cosine, Walsh, and Hadamard transformations, the zero frequency (DC component) is at the upper-left corner of the image.
Before running FTF, ensure that the specified output file (FILO) exists. If it does not, create it by executing CIM. For optimum performance, the transform file should be created in the tiled layout (for example, DBLAYOUT="TILED256" in CIM).
The output window size (Xsize, Ysize) must be a power of 2 (for example, 64, 128, 256, 512, ...) and be at least as large as the specified input window size. If the input window size is not a power of 2, rows and columns of zeros will be padded to the right side and bottom of the image to match the output window size.
Because FTF does not require the entire image to be loaded into memory, there is no limit on the size of input image.
Interpretation
Interpretation of frequency transformed images can be quite complicated. This section provides some background for interpreting Fourier-transformed images. For more information, see the References section.
When the Fourier transformation is selected, the output domain is the two-dimensional frequency spectrum of the input image. If these results are output to the display, a fairly symmetric pattern will appear. Frequencies are along two directions (X and Y). The DC component (frequency = (0,0)) is at (N/2+1,M/2+1), where N and M denote image size in pixels and lines. On a 512 x 512 image, for example, the DC point should be at (257,257). Points away from the DC point indicate higher frequencies. The transformation at point (N/2+1+x,M/2+1+y) corresponds to the cosine wave component which repeats every N/x pixels along X direction and every M/y pixels along Y direction.
Filter application
A typical application of frequency transformation is to apply image filters in the frequency domain for image enhancement, restoration, and other purposes.
The basis for the filter technique is to eliminate or reduce some frequencies while keeping others. A filter can be specified in a graphics bitmap by masking image regions to eliminate. FFREQ allows such a graphical filter, as well as built-in high-pass/low-pass filters to be applied to the image. When the inverse transformation is performed on the filtered image, the result is the original image with some frequencies removed. For example, the result of keeping only high frequencies would be the enhancement of edges.
For a real-valued image (such as an image from an optical sensor, or a detected radar image), its Fourier transform exhibits a property of conjugate symmetry about the center of the image: at a pair of corresponding points, the real parts of the Fourier transformation are equal and the imaginary parts have the same magnitude but opposite signs. For complex-valued images (such as single-look complex radar images) there is no such symmetry.
The FFREQ module assumes that transforms stored in real-valued channels (DBIC) are produced from real-valued images, while transforms stored in complex-valued channels are created from complex images. Therefore, for the two Fourier transforms, the number and type of output channel(s) in the DBOC parameter should be selected according to the content of the input image. For a real input image, its FIR or FMP transform should be stored in two 32-bit floating point real channels. For a complex input image, its FIR transform should be stored in one 32-bit floating point complex channel.
Back to top |
Perform a Fourier transformation on channel 1 of the file IRVINE.PIX and save the real and imaginary parts of the transformation in channels 12 and 13 (type 32-bit real) of the same file.
from pci.ftf import * fili = 'irvine.pix' filo = 'irvine.pix' dbic = [1] dboc = [12,13] dbiw = [] # process entire image dbow = [] # process entire image tform = "FIR" # Fourier with real, imaginary transformation ftf ( fili, filo, dbic, dboc, dbiw, dbow, tform )
Back to top |
Fourier transformation: uses the one-dimensional Cooley-Tukey fast Fourier transformation, applying it to the rows and columns of the image separately.
Walsh transformation: modifies one-dimensional Cooley-Tukey fast Fourier transformation by setting all trigonometric terms equal to one.
Hadamard transformation: modifies one-dimensional Cooley-Tukey fast Fourier transformation by setting all trigonometric equal to one and by eliminating bit-reversal mapping.
Cosine transformation: uses 2N-point fast Fourier transformation on the data, multiplying by a complex value and taking the real part of the resulting array from (0,0) to (N-1,N-1).
Back to top |
Gonzalez, R.C. and Wintz, P. [1987]. Digital Image Processing. 2nd Edition, Addison-Wesley, Massachusetts.
© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.