Preprocessing

qtec_hv_sdk.preprocessing.make_reference(source: Image, dtype: DType = hsi.float32, interleave: Interleave | None = None) Image

Create reference image for use in calibration.

Parameters:
  • source (Image) – A LxSxB image.

  • dtype (DType, default: hsi.float32) – Output data type.

  • interleave (Interleave | None, default: None) – Output interleave. If None, the interleave of the source image is used.

Returns:

A 1xSxB reference image.

Return type:

Image

qtec_hv_sdk.preprocessing.reflectance_calibration(image: Image, white_reference: Image, dark_reference: Image, clip: bool = True, nan_replacement: float | None = 0, dtype: DType = hsi.float32) Image

Calibrate reflectance image.

Parameters:
  • image (Image) – Source image of size LxSxB.

  • white_reference (Image) – White reference image of size 1xSxB.

  • dark_reference (Image) – Dark reference image of size 1xSxB.

  • clip (bool, default: True) – Whether to clip the output to valid values of 0-1.

  • nan_replacement (float | None, default: 0) – Value to use for NaN replacement. If None, NaN values are not replaced.

  • dtype (DType, default: hsi.float32) – Output data type.

Returns:

The calibrated image.

Return type:

Image

qtec_hv_sdk.preprocessing.savgol_filter(image: Image, window_length: int, polyorder: int = 2, dtype: DType = hsi.float32) Image

Apply a Savitzky-Golay filter along the spectral (bands) axis.

Smooths each pixel’s spectrum by fitting successive sub-windows with a polynomial of the given order. Only BIP and BIL interleaves are supported, since the bands axis must be contiguous in memory for the filter to be applied per pixel.

Parameters:
  • image (Image) – Source image of size LxSxB. Must be BIP or BIL interleaved.

  • window_length (int) – Length of the filter window (number of bands). Must be a positive odd integer greater than polyorder.

  • polyorder (int, default: 2) – Order of the polynomial used to fit the samples. Must be less than window_length.

  • dtype (DType, default: hsi.float32) – Data type used for the computation and output.

Returns:

The smoothed image, with the same shape and interleave as the input.

Raises:

ValueError – If the image has BSQ interleave.

Return type:

Image

qtec_hv_sdk.preprocessing.snv(image: Image, dtype=hsi.float32) Image

Standard Normal Variates (SNV) scatter correction.

SNV removes additive scattering.

Parameters:
  • image (Image)

  • dtype (default: hsi.float32) – Use this type for the calculation.

Returns:

The scatter corrected image.

Return type:

Image