| Environments | PYTHON :: EASI :: MODELER |
| Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Example :: Acknowledgements :: References :: Related |
| Back to top |
| Back to top |
fspec(file, dbic, dboc, flsz, ftyp, mask, nlook, damp, imagefmt, cthresh, ethresh, gthresh)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| FILE * | str | Input file name | 1 - | |
| DBIC * | List[int] | Input channel | 1 - 1 | |
| DBOC * | List[int] | Output channel | 1 - 1 | |
| FLSZ | List[int] | Filter size: x-dimension, y-dimension | 0 - 2 | 3 - Default: 3,3 |
| FTYP | str | Filter type | 0 - 7 | LEE|KUAN|FROST|ELEE|EFROST|GAMMA|TOUZI|AVERAGE|STDDEV Default: GAMMA |
| MASK | List[int] | Area mask | 0 - 4 | |
| NLOOK | List[float] | Number of looks | 0 - 1 | 1.0 - 100.0 Default: 1.0 |
| DAMP | List[float] | Damping factor | 0 - 1 | 0.0 - Default: 1.0 |
| IMAGEFMT | str | Image units | 0 - 9 | Amplitude, Power Default: Amplitude |
| CTHRESH | List[float] | Contour Threshold | 0 - 1 | 0.0 - 10.0 Default: 0.5 |
| ETHRESH | List[float] | Edge threshold | 0 - 1 | 0.0 - 10.0 Default: 0.5 |
| GTHRESH | List[float] | Gradient threshold | 0 - 1 | 0.0 - 10.0 Default: 0.1 |
| Back to top |
FILE
The name of the PCIDSK file containing the channel to filter.
DBIC
The input channel to filter.
DBOC
The output channel for the filtered data.
Only the area under the mask is written to the output channel.
FLSZ
The size of the filter, in pixels and lines, with which to apply the filter using a moving filter window. The values you specify must be two odd numbers, such as 1,3 or 3,1.
FTYP
MASK
The window or bitmap that defines the area to process in the input raster. If no value is specified for this parameter, the entire layer is used by default.
MASK=Xoffset, Yoffset, Xsize, Ysize
Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the width of the window. Ysize is the number of lines that define the height of the window.
With a bitmap mask, you specify the number of the bitmap segment that you want to use. All of the pixels in the specified segment having a pixel value of 1 define the area to process.
Only the area under the mask is written to the output.
NLOOK
The effective number of looks of the image, which FSPEC uses to derive noise variance. The value of this parameter determines the amount of smoothing applied to the image.
The range of acceptable values is from 1 to 100. The default value of 1 is appropriate for single-look data and applies maximum smoothing. However, if in the file metadata NumLooks contains a value, that value will be used as the default.
DAMP
The damping constant for the filter. Use this parameter only with the Enhanced Lee, Frost, and Enhanced Frost filters. This constant specifies the extent of the damping effect of the filtering. The default of 1.0 is sufficient for most SAR images.
Using values greater than 1.0 provides better preservation of sharp edges, but reduces the smoothing effect. Using values less than 1.0 increases the smoothing effect, but provides poorer preservation of sharp edges.
IMAGEFMT
The format or type of radar image.The image can be in Amplitude (AMP) or Power (POW). This information is usually in the image metadata. With a complex number a + bi, a corresponds to the real part (I) and b to the imaginary part (Q).
CTHRESH
The threshold of the curve-detection algorithm that determines whether a given pixel is part of a curved (or linear) feature.
Using higher values for this parameter preserves contours and curvilinear features, but reduces smoothing. Lower values increase the smoothing, but reduce preservation of contours or curvilinear features.
The default value of 0.5 is sufficient for most SAR images.
This parameter is optional.
ETHRESH
The threshold of the edge-detection algorithm that determines whether a given pixel is part of an edge.
Using higher values for this parameter preserves feature edges, but reduces smoothing. Lower values increase the smoothing, but reduce preservation of feature edges.
The default value of 0.5 is sufficient for most SAR images.
This parameter is optional.
GTHRESH
The maximum gradient of the coefficient of variation permitted between successive windows when determining the maximum isotropic area. Higher values increases the size of isotropic areas.
The default value of 0.1 is sufficient for most SAR images.
This parameter is optional.
| Back to top |
The filters smooth out noise while retaining edges or shape features in your image.
You specify the filter size with the FLSZ parameter, with 1, 3 or 3, 1 being the minimum size.
The FSPEC filters all of the pixels in your imagery. To filter pixels near the edges of the image, FSPEC replicates edge-pixel values to provide sufficient data.
Different filter sizes greatly affect the quality of the processed images. With a filter that is too small, the noise-filtering algorithm is ineffective. With a filter that is too big, subtle details of the image will be lost.
The MASK (Mask) parameter specifies the area in the input channel or layer to process. FSPEC filters only the area under the mask; the rest of the image remains unchanged. If you specify only a single value, this value points to a bitmap segment, which defines the area to filter. When you specify four values, they define the x and y offsets and the x and y dimensions of a rectangular window in the image to filter. When you use the default value, FSPEC processes the entire database.
You use the NLOOK (Number of Looks) parameter to estimate noise variance and control the amount of smoothing to apply to the image. Theoretically, the correct value for this parameter should be the effective number of looks of the radar image. It should be close to the actual number of looks, but may differ if the image has been resampled. You can experiment with adjusting the value to control the effect of the filter. A lesser value leads to more smoothing; a greater value preserves more image features.
When you use the Enhanced Lee, Frost, or Enhanced Frost filter, you must specify a value for the DAMP (Damping Factor) parameter. The value of this parameter defines the extent of exponential damping (the lesser the value, the lesser the damping effect). This depends on the unfiltered image and may require trial-and-error experiments to determine the best value. The default value is 1.
The Touzi filter uses the following parameters: CTHRESH (Contour Threshold), ETHRESH (Edge Threshold) and GTHRESH (Gradient Threshold). For more information about the Touzi filter, refer to the following:
Touzi R., "A review of speckle filtering in the context of estimation theory", IEEE TGRS (Transaction on Geoscience and Remote Sensing), Vol. 40, No. 11, September 2002, pp. 2392-2404.
Touzi R., "A protocol for speckle filtering for SARimages", CEOS Proceedings, Toulouse, France, October 1999.
| Back to top |
A Gamma filter is applied to channel 11 (radar image) of irvine.pix to remove speckle noise. A window of 7 x 7 is used. An experimentally selected NLOOK value of 10 provides a good balance between smoothing out noise and keeping important features.
from pci.fspec import fspec
file = 'irvine.pix'
dbic = [11] # input radar image
dboc = [8] # output filtered radar image
flsz = [7,7] # specifies a 7 x 7 filter
ftyp = 'GAMMA' # use GAMMA filter
mask = [] # default, process entire image
nlook = [10] # number of looks
damp = [] # default damping factor 1.0
imagefmt = 'AMP' # Amplitude image format
cthresh = [] # not used with GAMMA filter
ethresh = [] # not used with GAMMA filter
gthresh = [] # not used with GAMMA filter
fspec( file, dbic, dboc, flsz, ftyp, mask, nlook, damp, imagefmt, cthresh, ethresh, gthresh )
| Back to top |
The Touzi SAR filter algorithm that is incorporated into this software was developed by Dr. Ridha Touzi of the Canada Centre for Remote Sensing (CCRS), and is licensed to PCI Geomatics by Her Majesty the Queen in Right of Canada, represented by the Minister of Natural Resources.
PCI wishes to acknowledge the assistance of Dr. Ridha Touzi at the Canada Centre for Remote Sensing for providing source code and assisting in supporting his algorithm.
| Back to top |
Implementation of the speckle filters was based on the following papers, especially the review paper by Shi and Fung.
Jong-Sen Lee, "Digital Image Enhancement and Noise Filtering by Use of Local Statistics", IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAM1-2, No. 2, March, 1980.
J.S.Lee, "Refined Filtering of Image Noise Using Local Statistics" Computer Graphic and Image Processing 15, 380-389 (1981)
D.T. Kuan, A.A. Sawchuk, T.C. Strand, and P. Chavel, "Adaptive restoration of images with speckle," IEEE Transactions ASSP., Vol. 35, no. 3, pp. 373-383, March 1987.
A. Lopes, R. Touzi and E. Nezry, "Adaptive speckle filters and Scene heterogeneity", IEEE Transaction on Geoscience and Remote Sensing, Vol. 28, No. 6, pp. 992-1000, Nov. 1990.
V.S. Frost, J.A. Stiles, K.S. Shanmugan, and J.C. Holtzman, "A model for radar images and its application to adaptive digital filtering of multiplicative noise," IEEE Transactions Pattern Analysis and Machine Intelligence, vol. 4, no. 2, pp. 157-166, March 1982.
A. Lopes, E. Nezry, R. Touzi, and H. Laur, "Structure detection and statistical adaptive speckle filtering in SAR images", International Journal of Remote Sensing, Vol. 14, No. 9, pp. 1735-1758, 1993.
A. Lopes, R. Touzi and E. Nezry, "Adaptive speckle filters and Scene heterogeneity", IEEE Transaction on Geoscience and Remote Sensing, Vol. 28, No. 6, pp. 992-1000, Nov. 1990.
Zhenghao Shi and Ko B. Fung, 1994, "A Comparison of Digital Speckle Filters", Proceedings of IGRASS 94, August 8-12, 1994.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.