Skip to main content

Module spectral_unmix_nnls

Module spectral_unmix_nnls 

Source
Expand description

Non-negative least-squares lite for multi-channel spectral unmixing.

Model: observed spectrum y (C channels) ≈ A · x where A is C×N reference endmember matrix (column-major: channel-major per component), and x ≥ 0 are component abundances.

Solver: projected multiplicative update / projected gradient (bounded iters). Also supports per-pixel unmix into caller buffers and ROI-mean unmix.

Structs§

UnmixResult
Result of a single spectrum unmix.

Constants§

MAX_CHANNELS
Max channels / components for stack-bounded unmix.
MAX_COMPONENTS

Functions§

spectral_unmix_nnls
Unmix one observed spectrum y (length n_channels) against endmember matrix endmembers laid out as column-major: component k occupies endmembers[k * n_channels .. (k+1) * n_channels].
spectral_unmix_per_pixel
Per-pixel unmix: writes abundances into out_abundances laid out as pixel-major × n_components. Returns number of pixels written.
spectral_unmix_roi_mean
Mean the ROI spectra then unmix once (cheap path for bulk regions).