Skip to main content

spectralmatch: relative radiometric normalization toolkit for raster mosaics and time series

PyPI version PyPI Downloads QGIS Plugin Your-License-Badge codecov Open in Cloud Shell 📋 Copy LLM Prompt DOI DOI

Overview

Global and Local Matching

Spectralmatch provides algorithms to perform relative radiometric normalization (RRN) to enhance spectral consistency across raster mosaics and time series. It is built for geoscientific use, with a sensor- and unit-agnostic design, optimized for automation and efficiency on arbitrarily many images and bands, and works well with Very High Resolution Imagery (VHRI) as it does not require pixel co-registration. In addition to matching algorithms, the software supports cloud and vegetation masking, pseudo invariant feature (PIF) based exclusion, seamline network generation, raster merging, and plotting statistics. The toolkit is available as an open-source Python library, command line interface, and QGIS plugin.

Please cite as: Lindiwe et al., (2026). Spectralmatch: relative radiometric normalization toolkit for raster mosaics and time series. Journal of Open Source Software, 11(117), 8974, https://doi.org/10.21105/joss.08974

Features

  • Automated, Efficient, and Scalable: Designed for large-scale workflows with no manual steps, leveraging multiprocessing and Cloud Optimized GeoTIFF support for fast, efficient processing across images, windows, and bands.

  • Resumable Processing: Save image stats and block maps for quicker reprocessing.

  • Integrated Seamline and Cloud Masking: Generate seamlines and detect clouds within the same workflow.

  • Specify Model Images Include all or specified images in the matching solution to bring all images to a central tendency or selected images spectral profile.

  • Consistent Multi-image Analysis: Performs minimal necessary adjustments to achieve inter-image consistency while preserving the original spectral characteristics.

  • Joint Coregistration: Co-registers complete overlap networks with global correction followed by an optional smooth local displacement mesh to align features in the images.

  • Sensor and Unit Agnostic: Supports optical imagery from handheld cameras, drones, crewed aircraft, and satellites for reliable single sensor and multi-sensor analysis, while preserving spectral integrity across all pixel units—including negative values and reflectance.

  • Enhanced Imagery: Helpful when performing mosaics and time series analysis by blending large image collections and normalizing them over time, providing consistent, high-quality data for machine learning and other analytical tasks.

  • Open Source and Collaborative: Free under the MIT License with a modular design that supports community contributions and easy development of new features and workflows. Accessible through a python library, command line interface, and QGIS plugin.

Poster_AGU.pdf


Current Matching Algorithms

Global to local matching

This method applies least squares regression to estimate scale and offset parameters that align the histograms of all images toward a shared spectral center or specified set of images center. This is achieved by constructing a global model based on the overlapping areas of adjacent images, where the spectral relationships are defined. This global model ensures that each image conforms to a consistent radiometric baseline while preserving overall color fidelity. However, global correction alone cannot capture intra-image variability so a second local adjustment phase is performed. The overlap areas are divided into smaller blocks, and each block’s mean is used to fine-tune the color correction. This block-wise tuning helps maintain local contrast and reduces visible seams, resulting in seamless and spectrally consistent mosaics with minimal distortion. Pseudo invariant features can be automatically created by aligning image overlaps by orb match points and extracting low difference raster values. These methods draw on work from 'An auto-adapting global-to-local color balancing method for optical imagery mosaic' by Yu et al, 'Integrated Preprocessing of Multitemporal Very-High-Resolution Satellite Images via Conjugate Points-Based Pseudo-Invariant Feature Extraction' by Taeheon Kim and Youkyung Han, and others.

Assumptions

  • Consistent Spectral Profile: The true spectral response of overlapping areas remains the same throughout the images.

  • Least Squares Modeling: A least squares approach can effectively model and fit all images' spectral profiles.

  • Scale and Offset Adjustment: Applying scale and offset corrections can effectively harmonize images.

  • Minimized Color Differences: The best color correction is achieved when color differences are minimized.

  • Geometric Alignment: Images are assumed to be geometrically aligned with known relative positions via a geotransform. However, they only need to be roughly aligned as pixel co-registration is not required.

  • Global Consistency: Overlapping color differences are consistent across the entire image.

  • Local Adjustments: Block-level color differences result from the global application of adjustments.


Installation

For additional installation instructions see the Installation Methods in the docs.

Installation as a QGIS Plugin

In the QGIS plugin manager, install 'spectralmatch' and find it in the Processing Toolbox.

Installation as a Python Library and CLI

Ensure you have the following system-level prerequisites: Python ≥ 3.10 and ≤ 3.12, pip, PROJ ≥ 9.3, and GDAL ≥ 3.11; then use pip to install the library:

conda create -n spectralmatch python=3.12 "gdal>=3.11" "proj>=9.3" -c conda-forge
conda activate spectralmatch
pip install spectralmatch

Usage

Python

Example scripts and sample data are provided to verify a successful installation and help you get started quickly in the repository at /docs/examples and downloadable here. This is an example mosaic workflow using folders for each step:

import os
from spectralmatch import (
    joint_coregistration,
    Match,
    Seamline,
    mask_rasters,
    merge_rasters,
)

working_directory = "/path/to/working/directory"
input_folder = os.path.join(working_directory, "Input")
coregistered_folder = os.path.join(working_directory, "Coregistered")
global_folder = os.path.join(working_directory, "GlobalMatch")
local_folder = os.path.join(working_directory, "LocalMatch")
clipped_folder = os.path.join(working_directory, "Clipped")

joint_coregistration(
    input_images=input_folder,
    output_images=coregistered_folder,
    resolution="highest",
    tap=True,
)

Match.global_regression(
    input_images=coregistered_folder,
    output_images=global_folder,
)

Match.local_block_adjustment(
    input_images=global_folder,
    output_images=local_folder,
)

Seamline.voronoi(
    input_images=local_folder,
    output_mask=os.path.join(working_directory, "ImageMasks.gpkg"),
    image_field_name="image",
)

mask_rasters(
    input_images=local_folder,
    output_images=clipped_folder,
    vector_mask=("include", os.path.join(working_directory, "ImageMasks.gpkg"), "image"),
)

merge_rasters(
    input_images=clipped_folder,
    output_image_path=os.path.join(working_directory, "MergedImage.tif"),
)

CLI

There is a CLI that can be used for each function individually or with the pipeline function (also available in python):

spectralmatch pipeline /input/folder /output/file.tif --shared_debug_logs=True

QGIS Plugin

There is a QGIS plugin available that wraps the library to provide an easy to use gui available here.

High Performance Compute (Super computer)

Install the optional distributed Dask backend with pip install spectralmatch[dask] and pip install spectralmatch[dask_gui] for the gui. Image-level concurrent processing uses concurrent_processing_backend="process_pool" by default. To connect to an existing cluster, use concurrent_processing_backend="dask" and either dask_scheduler=("file", "/shared/scheduler.json") or dask_scheduler=("address", "tcp://scheduler:8786"). SpectralMatch does not start Dask workers: worker count, threads per worker, memory limits, and scaling are configured when the external Dask cluster is launched. To start a simple Dask service on your computer, run: `make start-dask DASK_NWORKERS=8 DASK_MEMORY_LIMIT=2GiB' and optionally add additional params found in the Makefile.


Documentation

Documentation is available at spectralmatch.github.io/spectralmatch/.


Contributing Guide

Contributing Guide is available at spectralmatch.github.io/spectralmatch/contributing.


License

This project is licensed under the MIT License. See LICENSE for details.

Project Support

This library was developed at the Spatial Data Analysis and Visualization Lab (SDAV) at the University of Hawaii at Hilo by Kanoa Lindiwe. Funding was partly provided by the Hau‘oli Mau Loa Foundation, in addition to the National Science Foundation EPSCoR grant 2149133, Change Hawaiʻi: Harnessing the Data Revolution for Island Resilience.

Metadata

Release files for spectralmatch 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spectralmatch 1.6.0
File Size Uploaded Provenance Actions
spectralmatch-1.6.0.tar.gz 129.5 kB With provenance Details for spectralmatch-1.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spectralmatch 1.6.0
File Interpreter ABI Platform Actions
spectralmatch-1.6.0-py3-none-any.whl Python 3 none any Details for spectralmatch-1.6.0-py3-none-any.whl

Total release size: 246.4 kB

Release files / spectralmatch-1.6.0.tar.gz

Download URL spectralmatch-1.6.0.tar.gz
Size 129.5 kB
Tags Source
SHA-256 checksum
How to use checksums
73de239859c230a6652c0a481144ff109955c42c50843824c2578eadd88866c7
BLAKE2b-256 checksum
How to use checksums
9ba04ea12de64be6a6c7274c27c540f1aa6b78448f08c333e39834c5b943f744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log

Release files / spectralmatch-1.6.0-py3-none-any.whl

Download URL spectralmatch-1.6.0-py3-none-any.whl
Size 116.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee3e8d54b52bf80527ba146ee092cc28fad8122afd4cf2dacf81631f20cd9e52
BLAKE2b-256 checksum
How to use checksums
50d5d2d4f65a0668660d2479691fae95f35094c9847b8f9276f33be04d995979
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log

Security for spectralmatch 1.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spectralmatch-1.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page