Skip to content

polsarpro.speckle_filters

This code is part of the Python PolSARpro software:

"A re-implementation of selected PolSARPro functions in Python, following the scientific recommendations of PolInSAR 2021"

developed within an ESA funded project with SATIM.

Author: Olivier D'Hondt, 2025. Scientific advisors: Armando Marino and Eric Pottier.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Description: module containing speckle filtering functions

pwf(input_data, train_window_size=[9, 9], test_window_size=[1, 1])

Speckle reduction using Polarimetric Whitening Filter.

Parameters:

Name Type Description Default
input_data Dataset

Input polarimetric SAR dataset. Supported types are:

  • "S": Sinclair scattering matrix

  • "C3": Lexicographic covariance matrix

  • "T3": Pauli coherency matrix

  • "C4" and "T4": 4x4 versions of the above

  • "C2": Dual-polarimetric covariance

required
train_window_size list[int, int]

Size of the spatial averaging window to be applied to compute the inverse covariance (boxcar filter). Defaults to [9, 9].

[9, 9]
test_window_size list[int, int]

Size of the spatial averaging window to be applied on the input covariance (boxcar filter). Defaults to [1, 1].

[1, 1]

Returns:

Type Description
Dataset

xr.Dataset: Result of the filtering.

Notes

If the S matrix is given as an input, it will be converted to C3.

refined_lee(input_data, window_size=7, num_looks=1)

Apply the Refined Lee Speckle Filter to a PolSAR dataset.

Parameters:

Name Type Description Default
input_data Dataset

Input PolSAR dataset containing covariance or coherency matrices. Works for 2x2, 3x3 and 4x4 matrices.

required
window_size int

Size of the filtering window (default is 7).

7
num_looks int or float

Number of looks of the input data (default is 1).

1

Returns:

Type Description
Dataset

xr.Dataset: Speckle filtered PolSAR dataset.

References

Lee, J.-S., Grunes, M. R., & Kwok, R. (1999). "Polarimetric SAR Speckle Filtering and Its Implications for Classification." IEEE Transactions on Geoscience and Remote Sensing, 37(5), 2363-2373. doi:10.1109/36.789467