Histogram matching

remote_sensing_processor.match_hist(input_path, reference_raster, output_path=None, nodata=None, write_stac=True)[source]

Matches histograms of two files.

Parameters:
  • input_path (string or STAC Item) – Path to an input file, directory or a STAC dataset or a STAC Item (e.g., from Planetary Computer).

  • reference_raster (string or STAC Item) – A raster that will be used as a reference in histogram matching.

  • output_path (string (optional)) – Path to an output file, directory, or STAC dataset. If not set, then will overwrite the input files. Must be set if input is a remote STAC Item.

  • nodata (int or float (default = None)) – Nodata value. If not set, then is read from inputs.

  • write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.

Returns:

Path where output raster is saved.

Return type:

pathlib.Path

Examples

>>> import remote_sensing_processor as rsp
>>> rsp.match_hist(
...     input_path="/home/rsp_test/image_1/sentinel_B1.tif",
...     output_path="/home/rsp_test/image_1/sentinel_B1_matched.tif",
...     reference_raster="/home/rsp_test/image_2/sentinel_B1.tif",
...     nodata=0,
... )