Generate Pauli RGB for FP data (pauli_rgb)#

polsartools.pauli_rgb(infolder, save_tif=False, window_size=None)[source]

Generate Pauli RGB image from polarimetric SAR data (C4, C3, T4, T3, or S2 matrices).

This function creates a Pauli decomposition RGB composite image from full polarimetric SAR data.

Examples

>>> # Generate Pauli RGB from a polarimetric folder
>>> pauli_rgb("/path/to/polSAR_data")
>>> # Output both PNG and GeoTIFF versions
>>> pauli_rgb("/path/to/polSAR_data", tif_flag=True)
Parameters:
  • infolder (str) – Path to the folder containing polarimetric matrix files (.bin or .tif). Supports full- and dual-pol data in formats: C4, C3, T4, T3, or S2.

  • save_tif (bool, default=False) – If True, generates both PNG and GeoTIFF (.tif) versions of the Pauli RGB image.

  • window_size (int, optional) – Size of the moving average window for smoothing. If None, no smoothing is applied.

Returns:

  • None

  • Writes output to

    • PauliRGB.png: RGB composite with world file for georeferencing

    • PauliRGB.tif: Optional GeoTIFF output if tif_flag=True

Generate false color RGB for DP/CP data (rgb_dp)#

polsartools.rgb_dp(infolder, type=1, save_tif=False, window_size=None)[source]

Generate false-color RGB visualization from dual-polarimetric Sxy, C2 SAR data.

This function creates an RGB image from dual-pol (Sxy, C2) matrix inputs.

Examples

>>> # Generate type-1 false-color RGB from C2 folder
>>> rgb_dp("/path/to/data")
>>> # Output both PNG and GeoTIFF versions
>>> rgb_dp("/path/to/data", type=3, tif_flag=True)
Parameters:
  • infolder (str) – Path to the input folder containing C2 matrix components (C11, C22, C12_real).

  • type (int, {1, 2, 3, 4}, default=1) – RGB combination type: - 1: Blue=C11, Red=C22, Green=|C11 + C22 - 2·C12_real| - 2: Blue=C22, Red=C11, Green=|C11 + C22 - 2·C12_real| - 3: Blue=C11, Red=C22, Green=|C11 - C22| - 4: Blue=C22, Red=C11, Green=|C22 - C11|

  • save_tif (bool, default=False) – If True, generates a GeoTIFF (.tif) file alongside the PNG image.

Returns:

Writes RGB visualization to disk: - ‘RGB#.png’: False-color PNG image (with world file for georeferencing) - ‘RGB#.tif’: Optional GeoTIFF output if tif_flag=True

Return type:

None

Generate false color RGB for decomposed powers (rgb)#

polsartools.rgb(Rpath, Gpath, Bpath, norm_each=True, lp=5, gp=95, norm_span=False, save_tif=False, window_size=None)[source]

Generate false-color RGB visualization from three input raster files.

Examples

>>> # Generate Pauli RGB from a polarimetric folder
>>> rgb("/path/to/red.tif", "/path/to/green.tif", "/path/to/blue.tif")
>>> # Output both PNG and GeoTIFF versions
>>> rgb("/path/to/red.tif", "/path/to/green.tif", "/path/to/blue.tif", tif_flag=True)
Parameters:
  • Rpath (str) – Path to the red channel raster file.

  • Gpath (str) – Path to the green channel raster file.

  • Bpath (str) – Path to the blue channel raster file.

  • norm_each (bool, default=True) – If True, normalize each channel separately.

  • lp (int, default=5) – Lower percentile for normalization (0-100). Only used if norm_each=True.

  • gp (int, default=95) – Upper percentile for normalization(0-100). Only used if norm_each=True.

  • norm_span (bool, default=False) – If True, normalize each channel with total power.

  • save_tif (bool, default=False) – If True, generates a GeoTIFF (.tif) file alongside the PNG image.

  • window_size (int, optional) – Size of the moving average window for smoothing. If None, no smoothing is applied.

Returns:

  • None

  • Writes output to

  • - RGB.png (RGB composite with world file for georeferencing)

  • - RGB.tif (Optional GeoTIFF output if tif_flag=True)

Generate polarimetric signatures for FP data (signature_fp)#

polsartools.signature_fp(mat=None, title='', ppath='', cmap='jet', plotType=1, fig=None, axes=None, start_index=0)[source]

Generates and visualizes polarimetric signatures from a 2x2 scattering matrix (S2) or a 3x3 coherency matrix (T3).

Examples

>>> mat = np.array([[1, 0], [0, 1]]) # Trihedral
>>> signature_fp(mat, title='Trihedral', plotType=1)
Parameters:
  • mat (np.ndarray (2x2 or 3x3) or None) – Input matrix. If shape is (2, 2), treated as S2. If (3, 3), treated as T3. If None, only theoretical/canonical plots will be generated.

  • title (str, optional) – Title of the plot. Default is an empty string.

  • ppath (str, optional) – Name of the output file (*.png). Default is an empty string.

  • cmap (str, optional) – Colormap used for visualizing the data. Default is ‘jet’.

  • plotType (int, optional) –

    Determines the type of plot to generate:

    • 1: Standard polarimetric signature via pol_sign.

    • 2: 2D polarimetric signature via pol_sign2d.

    • 3: Poincaré sphere mapping via poincare_plot.

    • 4: Render empty or canonical Poincaré sphere via poincare_sphere (S2 not required).