| Environments | PYTHON :: EASI :: MODELER |
| Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Example :: Algorithm :: Acknowledgements :: References :: Related |
| Back to top |
| Back to top |
pspolfil (fili, filo, flsz, nlook)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| FILI * | str | Input polarimetric SAR image | 1 - | |
| FILO * | str | Output filtered image | 1 - | |
| FLSZ | List[int] | Filter size (pixels) | 0 - 1 | 5 | 7 | 9 | 11 | 13 | 15 | 17 | 19 | 21 | 23 | 25 | 27 | 29 | 31 | 33 Default: 5 |
| NLOOK | List[float] | Equivalent number of looks | 0 - 1 | 1 - |
| Back to top |
FILI
The name of the input polarimetric SAR data set that contains the input data to filter. The input data set must contain either non-symmetrized or symmetrized fully polarimetric (quad-polarization) data in scattering, covariance, coherence, or Kennaugh matrix format.
The input data set must be a data set that has already been imported into the PCIDSK (.pix) format by SARINGEST, or it may be the key file name of any GDB-supported POLSAR data set in its distribution format. For more information, including a complete list of supported SAR sensors and data products, follow the link to SARINGEST under Related functions at the end of this topic.
FILO
The name of the output filtered polarimetric SAR image. The output data set has the same dimensions as the input. The number of output channels is the same as in the input image for data in the covariance, coherency, and Kennaugh matrix formats. Input data sets in the scattering matrix format are converted to the covariance matrix format automatically. For such data, the number of output channels depends on the symmetry of the input matrix.
The specified file must not already exist.
The output image represents the same physical quantity as the input data set (beta0, sigma0, or gamma0).
FLSZ
The size of the square filter window that is moved across the input image to determine the output pixel value. An odd integer between 5 and 33 must be specified; the default value is 5. Increasing the value of this parameter increases the processing time at approximately a quadratic rate."
NLOOK
The equivalent number of looks (ENL) in the input data set. The minimum valid value is 1. A float greater than or equal to 1 should only be specified if the data has already been speckle-filtered. The maximum value depends on the type of product being used. If this parameter is not specified, PSPOLFIL will try to find the number of looks in the metadata. If the number of looks is not found in the metadata, a default value of 1, which corresponds to single-look images, is applied.
Instead of 1, the default value of this parameter will be the file level metadata value for 'NumLooks' if this metadata exists.
| Back to top |
PSPOLFIL applies a Lee adaptive-speckle filter to an input SAR data set. As opposed to the boxcar filter, this filter preserves the edges. Edge detection and homogeneity parameters are estimated from the local power image.
For input data in all other matrix formats, the output matrix type and the number of channels in the output file are the same as in the input file.
| Back to top |
Apply a speckle filter to a SIR_C data set. The input SIR-C MLC-Q data set is already imported into the PCIDSK format. Use the default 5 filtering window.
from pci.pspolfil import pspolfil
fili ="sir_c.pix"
filo ="sc_sp5x5.pix"
flsz =[]
nlook =[5.6529984]
pspolfil( fili, filo, flsz, nlook )
| Back to top |
The algorithm in PSPOLFIL is based on the article in the reference section. If the input data set is in the scattering matrix format, it is converted to the covariance matrix format. The total power image is then created as in the PSTOTPOW program. Every pixel P(i,j) of the total power image represents the sum of intensities of all polarizations in the input data set.
The total power image is then averaged with a 3x3 window as follows:
1 1 1
Pav(i,j) = - * Sum ( Sum ( P(i'+i,j'+j) ) )
9 i'=-1 j'=-1
Several working parameters are derived as follows:
L = NUMLK
N = WINSIZE
m = (N - 3) / 2
n = (N + 1) / 2
N2 = (N * (N + 1)) / 2
PSPOLFIL then loops over all lines and pixels of the input data set. The processing at every pixel proceeds as follows:
1 1
wd = | Sum ( Sum ( Wd(i',j') * Pav(m*i'+i,m*j'+j) ) ) |
i'=-1 j'=-1
The four edge detection windows, Wd, are defined as follows:
(-1 0 1) (-1 -1 -1) (-1 -1 0) ( 0 -1 -1)
W1 = (-1 0 1) W2 = ( 0 0 0) W3 = (-1 0 1) W4 = ( 1 0 -1)
(-1 0 1) ( 1 1 1) ( 0 1 1) ( 1 1 0)
ws = max ( w1, w2, w3, w4 )
All elements of the NxN windows Fk are either 0 or 1. A pixel set to 1 selects the corresponding image pixel to contribute to filtering of the central pixel. A pixel set to 0 eliminates the corresponding image pixels from filtering. Four windows have 1-valued pixels in the left, right, upper half, or lower half, including the central row or column. The remaining four windows have 1-valued pixels in the upper-left, upper-right, lower-left, or lower-right quadrant, including the right or left diagonal.
The two Fk windows that are aligned with the strongest edge, ws, are examined. The window with its avearge power closest to the Pav of the central pixel is selected and is represented as F.
1 n n
mu = --- * Sum ( Sum ( F(i',j') * P(i'+i,j'+j) ) )
N2 i'=-n j'=-n
1 n n N2
nu = ---- * Sum ( Sum ( F(i',j') * P(i'+i,j'+j)^2 ) ) - ---- * mu^2
N2-1 i'=-n j'=-n N2-1
L*nu - mu^2
b = max( -----------, 0 )
(L+1) * nu
1-b n n
Vf(i,j) = b * V(i,j) + --- * Sum ( Sum ( F(i',j') * V(i'+i,j'+j) ) )
N2 i'=-n j'=-n
V(i,j) represents the original value of the polarimetric matrix element at the current pixel. Vf(i,j) represents the filtered value of the same element. It is stored in the output channel as a floating point pixel value.
| Back to top |
PCI Geomatics gratefully acknowledges the financial support provided by the Canadian Space Agency through the Earth Observation Application Development Program (EOADP), contract number 9F028-034946.
| Back to top |
Lee J.S., M.R. Grunes, and G. de Grandi. "Polarimetric SAR speckle filtering and its implication for classification", IEEE Trans. Geosci. Remote Sensing, 37, no. 5 (1999): 2363-2373.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.