torchbp.polarimetry module

torchbp.polarimetry.ainsworth(sar_img, weight=None, k=1, pol_order=['VV', 'VH', 'HV', 'HH'], max_iters=50, epsilon=1e-06, corner_hh_vv=None)[source]

Solve for polarimetric calibration from fully-polarimetric data. [1]

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape should be [4, M, N].

  • weight (Tensor or None) – Weight for correlation matrix calculation, should have shape [M, N].

  • k (complex) – HH/VV calibration factor.

  • pol_order (list) – Order of polarizations in the SAR image.

  • max_iters (int) – Maximum number of optimization iterations.

  • epsilon (float) – Optimization termination threshold.

  • corner_hh_vv (complex or None) – Measured HH/VV ratio of corner reflector. Used to solve for k if not None.

Return type:

Tensor

References

[1]

T. L. Ainsworth, L. Ferro-Famil and Jong-Sen Lee, “Orientation angle preserving a posteriori polarimetric SAR calibration,” in IEEE Transactions on Geoscience and Remote Sensing, vol. 44, no. 4, pp. 994-1003, April 2006.

Returns:

Minv – Normalized polarimetric calibration matrix.

Return type:

Tensor

Parameters:
  • sar_img (Tensor)

  • weight (Tensor | None)

  • k (complex)

  • pol_order (list)

  • max_iters (int)

  • epsilon (float)

  • corner_hh_vv (complex | None)

torchbp.polarimetry.apply_cal(sar_img, cal)[source]

Apply polarimetric calibration matrix to SAR image.

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape should be [4, M, N].

  • cal (Tensor) – 4x4 polarimetric calibration correction matrix.

Returns:

caled – Calibrated SAR image.

Return type:

Tensor

torchbp.polarimetry.correlation_matrix(sar_img, weight=None, pol_order=['VV', 'VH', 'HV', 'HH'], output_order=['HH', 'HV', 'VH', 'VV'], device=None, dtype=None)[source]

Calculate polarimetric correlation matrix.

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape should be [C, M, N], where C is the number of polarizations.

  • weight (Tensor or None) – Weight for correlation matrix calculation. Should be 2D, dimensions are interpolated to match sar_img if shape doesn’t match.

  • pol_order (list) – Order of polarizations in the SAR image.

  • output_order (list) – Order of polarizations in the correlation matrix.

  • device (str) – Pytorch device.

  • dtype (torch.dtype) – Correlation matrix dtype. Normally either torch.complex64 or torch.complex128.

Returns:

c – Correlation matrix.

Return type:

Tensor

torchbp.polarimetry.distortion_matrix(alpha=1.0, k=1.0, u=0.0, v=0.0, w=0.0, z=0.0, pol_order=['VV', 'VH', 'HV', 'HH'], device=None, dtype=torch.complex64)[source]

Construct a polarimetric distortion matrix from channel imbalance and crosstalk parameters. [1]

Parameters:
  • alpha (complex) – Cross-pol (HV/VH) channel imbalance.

  • k (complex) – Co-pol (HH/VV) channel imbalance.

  • u (complex) – Crosstalk parameters. The receive crosstalk is [[1, w], [u, 1]] and the transmit crosstalk [[1, v], [z, 1]] (the full crosstalk matrix is their Kronecker product).

  • v (complex) – Crosstalk parameters. The receive crosstalk is [[1, w], [u, 1]] and the transmit crosstalk [[1, v], [z, 1]] (the full crosstalk matrix is their Kronecker product).

  • w (complex) – Crosstalk parameters. The receive crosstalk is [[1, w], [u, 1]] and the transmit crosstalk [[1, v], [z, 1]] (the full crosstalk matrix is their Kronecker product).

  • z (complex) – Crosstalk parameters. The receive crosstalk is [[1, w], [u, 1]] and the transmit crosstalk [[1, v], [z, 1]] (the full crosstalk matrix is their Kronecker product).

  • pol_order (list) – Order of polarizations of the matrix rows and columns.

  • device (str) – Pytorch device.

  • dtype (torch.dtype) – Output dtype, normally torch.complex64.

Return type:

Tensor

References

[1]

T. L. Ainsworth, L. Ferro-Famil and Jong-Sen Lee, “Orientation angle preserving a posteriori polarimetric SAR calibration,” in IEEE Transactions on Geoscience and Remote Sensing, vol. 44, no. 4, pp. 994-1003, April 2006.

Returns:

M – 4x4 polarimetric distortion matrix.

Return type:

Tensor

Parameters:
  • alpha (complex)

  • k (complex)

  • u (complex)

  • v (complex)

  • w (complex)

  • z (complex)

  • pol_order (list)

  • dtype (dtype)

torchbp.polarimetry.k_alpha_cal(sar_img, weight=None, alpha=None, k=1, pol_order=['VV', 'VH', 'HV', 'HH'], corner_hh_vv=None)[source]

Polarimetric calibration assuming zero crosstalk.

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape should be [4, M, N].

  • weight (Tensor or None) – Weight for correlation matrix calculation, should have shape [M, N].

  • alpha (complex or None) – sqrt(RXVV * TXHH / (RXHH * TXVV)). Estimated from the data if alpha is None.

  • k (complex) – RXHH/RXVV calibration factor.

  • pol_order (list) – Order of polarizations in the SAR image.

  • corner_hh_vv (complex or None) – Measured HH/VV ratio of corner reflector. Used to solve for k if not None.

Returns:

Minv – Normalized polarimetric calibration matrix.

Return type:

Tensor

torchbp.polarimetry.orientation_angle(sar_img, weight=None, pol_order=['VV', 'VH', 'HV', 'HH'])[source]

Estimate a single global polarimetric orientation angle (POA). [1]

Use orientation_angle_image for a spatially-varying orientation map.

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape [3, M, N] or [4, M, N]. Use “HV” for the cross-polarized channel if the image has three polarizations.

  • weight (Tensor or None) – Optional spatial weight of shape [M, N] for the average.

  • pol_order (list) – Order of polarizations in the SAR image.

Return type:

Tensor

References

[1]

Jong-Sen Lee, D. L. Schuler and T. L. Ainsworth, “Polarimetric SAR data compensation for terrain azimuth slope variation,” in IEEE Transactions on Geoscience and Remote Sensing, vol. 38, no. 5, pp. 2153-2163, Sept. 2000.

Returns:

theta – Scalar orientation angle.

Return type:

Tensor

Parameters:
  • sar_img (Tensor)

  • weight (Tensor | None)

  • pol_order (list)

torchbp.polarimetry.orientation_angle_image(sar_img, window=(5, 5), pol_order=['VV', 'VH', 'HV', 'HH'])[source]

Estimate a per-pixel polarimetric orientation angle (POA) map. [1]

Same estimator as orientation_angle, but the coherency-matrix terms are averaged over a sliding boxcar window so a spatially-varying orientation angle is returned (e.g. an orientation map induced by terrain slopes).

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape [3, M, N] or [4, M, N]. Use “HV” for the cross-polarized channel if the image has three polarizations.

  • window (tuple or int) – Boxcar averaging window (height, width). A single int is used for both. Larger windows reduce estimation noise but blur the map.

  • pol_order (list) – Order of polarizations in the SAR image.

Return type:

Tensor

References

[1]

Jong-Sen Lee, D. L. Schuler and T. L. Ainsworth, “Polarimetric SAR data compensation for terrain azimuth slope variation,” in IEEE Transactions on Geoscience and Remote Sensing, vol. 38, no. 5, pp. 2153-2163, Sept. 2000.

Returns:

theta – Orientation angle map of shape [M, N].

Return type:

Tensor

Parameters:
  • sar_img (Tensor)

  • window (tuple | int)

  • pol_order (list)

torchbp.polarimetry.pol_antenna_rotation(sar_img, theta, pol_order=['VV', 'VH', 'HV', 'HH'])[source]

Calculate polarimetric SAR image with antenna rotated by angle theta around the antenna axis. [1]

Parameters:
  • sar_img (Tensor) – Input SAR image. Shape should be [3, M, N] or [4, M, N].

  • theta (float) – Rotation angle.

  • pol_order (list) – Order of polarizations in the SAR image. Use “HV” for cross-polarized channel if image has three polarizations.

Return type:

Tensor

References

[1]

K. Sarabandi and F. T. Ulaby, “A convenient technique for polarimetric calibration of single-antenna radar systems,” in IEEE Transactions on Geoscience and Remote Sensing, vol. 28, no. 6, pp. 1022-1033, Nov. 1990.

Returns:

sar_img – SAR image after rotation.

Return type:

Tensor

Parameters:
  • sar_img (Tensor)

  • theta (float)

  • pol_order (list)