Hyperspectral Analysis
Technical & Scientific Documentation

A complete single-page reference for the planned hyperspectral toolbox: spectral preprocessing, dimensionality reduction, endmember discovery, spectral-library classification, and sub-pixel unmixing.

Surface ReflectanceVNIR / SWIRWavelength-awareSAM / SIDEndmembersAbundance Mapping

1. Scope & Final Hyperspectral Toolbox

This module starts after radiometric and atmospheric preprocessing. Its preferred input is a calibrated reflectance cube with reliable wavelength metadata. The tools are intentionally independent: users do not have to run every tool in sequence.

Hyperspectral
├─ Spectral Smoothing
├─ Spectral Derivative
├─ Continuum Removal
├─ Minimum Noise Fraction (MNF)
├─ Endmember Extraction
├─ Spectral Library Matching
│    ├─ SAM — Spectral Angle Mapper
│    └─ SID — Spectral Information Divergence
└─ Spectral Unmixing
Key design decision: Spectral Library Matching and Spectral Unmixing are parallel analytical outcomes. Library Matching asks “which material is this pixel most similar to?”, while Unmixing asks “what fraction of each material is present in this pixel?”.
ToolMain PurposeInput BandsMain OutputOutput Dimension
Spectral SmoothingReduce spectral noise while preserving spectral shapeN wavelength bandsSmoothed spectral cubeUsually N bands
Spectral DerivativeEmphasize slope, edge, and absorption-shape changesN wavelength bandsDerivative spectral cubeN recommended; mathematically N−1/N−2 is also possible
Continuum RemovalNormalize absorption features relative to an upper continuumN wavelength bandsContinuum-removed cubeN bands
MNFSeparate signal from noise and reduce dimensionalityN bandsM MNF componentsM ≤ N, commonly M ≪ N
Endmember ExtractionFind spectrally pure/extreme signaturesN bands or selected MNF componentsK spectral signatures + locationsK rows × N wavelengths in the preferred physical library
Spectral Library MatchingWhole-pixel material identification/classificationN spectral bands + reference spectraClass/material raster + score1 class band + optional score/rule bands
Spectral UnmixingEstimate sub-pixel material fractionsN bands + K endmembersAbundance rasterK abundance bands (+ residual/RMSE optional)

2. Scientific Foundation

2.1 Hyperspectral pixel as a vector

A hyperspectral pixel is not a single brightness value. It is a vector containing measurements across many narrow spectral bands. For a pixel with N bands:

x = [x1, x2, …, xN]Txᵢ is the radiometric quantity measured at wavelength λᵢ; for this toolbox, surface reflectance is preferred.

If the image contains 200 bands, each pixel is a point in a 200-dimensional spectral space. A material such as vegetation, water, soil, kaolinite, calcite, or iron oxide can have a characteristic spectral shape or “spectral fingerprint”.

2.2 Reflectance domain

Reflectance is dimensionless. Physically, a reflectance of 0.20 corresponds to 20% reflectance under the measurement definition. In real corrected remote-sensing products, valid values can occasionally fall slightly below 0 or above 1 because of noise, correction artifacts, adjacency effects, scaling, or retrieval uncertainty. Therefore the analysis engine should not automatically clip all values to [0,1] unless the selected method specifically requires it.

2.3 Wavelength alignment is fundamental

For spectral matching or endmember-based analysis, the numerical band index is not enough. The engine should know each band's center wavelength and preferably its spectral response or FWHM. Two spectra can only be compared meaningfully when they represent the same wavelength space. Reference libraries therefore normally require spectral resampling to the image wavelengths.

Important: “Band 40” from one sensor is not automatically equivalent to “Band 40” from another sensor. The correct relationship is established by wavelength and spectral response, not by band number.

3. Recommended Workflow

The seven tools form a toolbox, not a mandatory linear pipeline.

Radiometric / Atmospheric Preprocessing ↓ Surface Reflectance Cube │ ├── Spectral Smoothing ───────────────┐ │ │ ├── Spectral Derivative │ │ ├──→ Spectral Library Matching ├── Continuum Removal │ ├─ SAM │ │ └─ SID ├── MNF ──→ Endmember Extraction ─────┤ ↓ │ │ │ Material/Class Map │ │ │ │ └─────────────────┴──→ Spectral Unmixing │ ↓ │ Abundance Maps │ └── Direct ML / Deep Learning / other analysis

3.1 Two important final branches

Whole-pixel spectral classification

SAM/SID compare each image spectrum to a reference spectrum and can assign one dominant material/class to each pixel.

Pixel spectrum
     +
Reference library
     ↓
SAM / SID
     ↓
1-band class map

Sub-pixel decomposition

Spectral Unmixing estimates the fractional contribution of multiple endmembers to the same pixel.

Pixel spectrum
     +
K endmembers
     ↓
Unmixing
     ↓
K abundance bands
A spectral-unmixing result should normally not be passed to SAM/SID spectral-library matching, because its bands are no longer wavelengths. They represent endmember abundances.

4. Recommended Input Data Contract

4.1 Required or strongly recommended metadata

MetadataRequirementReason
Band countRequiredDefines spectral vector dimension.
Center wavelength λStrongly recommendedNeeded for derivatives, continuum analysis, spectral resampling and library matching.
Wavelength unitsRequired for matchingnm and μm must not be mixed silently.
FWHM / spectral responseRecommendedImproves library-to-sensor resampling.
Scale / offsetRequired if encodedConverts stored integer values to physical reflectance.
NoData / bad-band maskRecommendedPrevents atmospheric absorption/noisy bands from corrupting analysis.
Product levelRecommendedAllows the system to distinguish DN/radiance/TOA/surface reflectance.

4.2 Preferred data state

Preferred:
Surface Reflectance
+ wavelength metadata
+ bad-band mask
+ valid scale/offset already applied or declared

Accepted with warning:
Radiance / TOA Reflectance
Unknown wavelength metadata
Generic band-index-only raster

Band-index-only mode can still support some mathematical processing, but physically meaningful spectral matching should be marked as limited or rejected when wavelength alignment cannot be established.

5. Spectral Smoothing

Spectral smoothing reduces high-frequency noise along the spectral axis. It does not blur the image spatially. For a 200-band cube, the preferred output remains 200 bands so that the wavelength grid remains unchanged.

N → NTypical dimension
Reflectance-likePhysical domain usually retained
Spectral axisNot spatial convolution
OptionalNot always necessary

5.1 Moving-average smoothing

R̃(λi) = (1 / (2m+1)) Σj=-m…m R(λi+j)A window of width 2m+1 is averaged. Simple but can flatten narrow absorption features.

5.2 Weighted/Gaussian smoothing

i = Σj wjRi-j,    Σjwj = 1Weights are larger near the center of the window. The engine must define edge handling explicitly.

5.3 Savitzky–Golay smoothing

Savitzky–Golay smoothing fits a low-order polynomial to a moving local spectral window using least squares. The center value of the fitted polynomial becomes the smoothed value. It is attractive for spectroscopy because it can preserve peak shape and can also provide analytical derivative estimates.

mina₀…aₚ Σj=-m…m [Ri+j − Σk=0…pakjk]2p = polynomial order; 2m+1 = window size. The window must be larger than the polynomial order.

5.4 Recommended parameters

  • Method: Savitzky–Golay / Moving Average / Gaussian.
  • Window size: odd number such as 5, 7, 9, 11 bands.
  • Polynomial order: commonly 2 or 3 for Savitzky–Golay.
  • Wavelength-aware mode: preferred when band spacing is irregular.
  • Bad bands: should be masked or interpolated before smoothing.

5.5 Output

Input : 200-band surface reflectance
Output: 200-band smoothed spectral cube

Band 1  → same λ1
Band 2  → same λ2
...
Band 200→ same λ200
A large smoothing window may remove exactly the narrow absorption features that hyperspectral analysis is intended to detect.

6. Spectral Derivative

Spectral derivatives emphasize changes in the shape of a spectrum. They can suppress broad baseline effects and reveal absorption edges, inflection points, and subtle spectral differences. The output is not reflectance; its units depend on wavelength units.

6.1 First derivative

R′(λi) ≈ [R(λi+1) − R(λi-1)] / [λi+1 − λi-1]Centered finite difference for interior bands.

6.2 Second derivative

For approximately uniform spectral spacing Δλ:

R″(λi) ≈ [Ri+1 − 2Ri + Ri-1] / (Δλ)2

6.3 Savitzky–Golay derivative

The same local polynomial used for Savitzky–Golay smoothing can be differentiated analytically, often producing a more stable derivative than applying a finite difference directly to noisy spectra.

6.4 Why smoothing often precedes derivative

Differentiation amplifies high-frequency noise. Therefore:

Surface Reflectance
      ↓
Spectral Smoothing
      ↓
1st / 2nd Derivative

6.5 Output dimension

Mathematically, naïve differencing may yield N−1 or N−2 samples. For a raster-analysis platform, the recommended contract is to preserve N output bands by using centered differences for interior wavelengths, one-sided differences or declared NoData at edges, and retaining original wavelength metadata.

Recommended platform behavior: 200-band input → 200-band derivative output, with metadata indicating derivative order and wavelength units.

7. Continuum Removal

Continuum removal normalizes a spectrum relative to an upper continuum, usually represented by a convex hull over the spectrum. It is especially useful for comparing the position, shape and depth of absorption features.

7.1 Basic equation

RCR(λ) = R(λ) / C(λ)R(λ) = observed reflectance; C(λ) = continuum curve; RCR = continuum-removed reflectance.

At wavelengths where the measured spectrum touches the continuum, RCR is close to 1. Inside an absorption feature, it is typically less than 1.

7.2 Absorption depth

D(λ) = 1 − RCR(λ)Greater D indicates a deeper feature relative to the local continuum.

7.3 Output

Input : 200-band reflectance
Output: 200-band continuum-removed cube

Original wavelength dimension is preserved.
Output values are normalized spectral response, not original surface reflectance.

7.4 Spectral subset matters

The continuum depends on the wavelength interval used to construct it. The UI should therefore allow all valid bands, a wavelength range, or selected spectral windows.

If SAM/SID is applied to a continuum-removed image, the reference spectral library should undergo the same continuum-removal operation over the same wavelength range.

8. Minimum Noise Fraction (MNF)

MNF is a noise-aware linear transformation designed to order transformed components by image quality / signal-to-noise information. It is commonly used to determine effective data dimensionality, separate noisy components, and reduce subsequent computational cost.

N → MTypical dimensional reduction
M ≤ NUser/auto selected
Noise-awareUnlike ordinary PCA
ComponentsNot physical wavelengths

8.1 Data model

x = s + nx = observed spectral vector; s = signal; n = noise.

Let Σn be the estimated noise covariance matrix.

8.2 Noise whitening

z = Σn−1/2(x − μ)The whitening transform scales the data so that the estimated noise covariance becomes approximately the identity matrix.

8.3 Second rotation

Compute the covariance of the noise-whitened data:

Σz = E[(z − μz)(z − μz)T]

Then solve the eigenproblem:

Σzvi = λivi

The ordered eigenvectors define the MNF transform:

y = VTΣn−1/2(x − μ)

8.4 Why output can be much smaller

Input: 200 spectral bands
      ↓
Forward MNF
      ↓
MNF 1    strong information
MNF 2    strong information
...
MNF 20   usable
MNF 21+  increasingly noisy
      ↓
Output selected M = 20 components

A full MNF transform can contain N components, but the practical benefit is often obtained by retaining only the informative first M components. The output bands are MNF components, not wavelengths.

8.5 Noise estimation

When a dedicated dark/noise image is unavailable, a practical approach estimates noise from local spatial differences, assuming adjacent pixels share similar signal but have independent noise. The method used should be recorded in output metadata because MNF results depend strongly on the noise model.

8.6 Recommended parameters

  • Noise estimation: spatial shift difference / external noise covariance / user-supplied noise raster.
  • Number of components: Auto or integer M.
  • Selection criterion: eigenvalue curve, estimated SNR, cumulative information, or manual QC threshold.
  • Whitening regularization: needed if the noise covariance matrix is ill-conditioned.
MNF components cannot be compared directly with a laboratory spectral library unless the reference spectra are transformed using the same fitted MNF transform.

9. Endmember Extraction

An endmember is a spectral signature representing a relatively pure material or an extreme spectral component in the scene. Endmember extraction is not a classification raster. Its primary result is a set of spectral signatures and, where possible, the source pixel locations.

9.1 Output concept

Input image: 200 bands
Requested endmembers: K = 6

Output spectral library:
Endmember 1 → 200 spectral values
Endmember 2 → 200 spectral values
Endmember 3 → 200 spectral values
Endmember 4 → 200 spectral values
Endmember 5 → 200 spectral values
Endmember 6 → 200 spectral values

If the search is performed in reduced MNF space, the preferred workflow is to retain the pixel locations and sample the original/smoothed reflectance cube at those locations so that the final endmember library remains in physical wavelength space.

9.2 Geometric interpretation

Under a linear-mixture model, image pixels occupy a cloud in high-dimensional spectral space. Pure materials tend to occur near the extreme vertices of the data cloud, while mixtures lie between them.

x ≈ M aM contains endmember spectra as columns; a contains abundance fractions. Geometrically, feasible mixtures lie inside the simplex formed by the endmembers.

9.3 PPI — Pixel Purity Index

PPI repeatedly projects spectra onto random directions. Pixels occurring most often at the extreme ends of those projections receive a high purity count.

PPI(xj) = Σr=1…R I[xj is an extreme projection for direction r]R = number of random projections; I[·] = indicator function.

PPI is commonly applied to informative MNF components to reduce noise and dimensionality before searching for pure pixels.

9.4 N-FINDR concept

N-FINDR searches for a set of pixels that maximizes simplex volume in spectral space.

V ∝ |det(A)| / (K−1)!A is an augmented matrix built from candidate endmember vectors. The algorithm iteratively replaces candidates when simplex volume increases.

9.5 VCA — Vertex Component Analysis

VCA is an unsupervised endmember-extraction method based on the geometry of linear mixtures. It searches for vertices of the data simplex by repeated projections under assumptions that include the presence of sufficiently pure signatures.

9.6 Recommended platform methods

MethodStrengthTypical RequirementSuggested Status
PPIIntuitive pure-pixel ranking; produces a purity rasterIterations, threshold; often MNF inputRecommended
VCAFast geometric endmember extractionNumber K; pure-pixel assumptionRecommended
N-FINDRSimplex-volume optimizationNumber K; iterative searchAdvanced

9.7 Recommended output object

{
  "analysis": "endmember_extraction",
  "method": "VCA",
  "source_raster": "...",
  "wavelength_unit": "nm",
  "wavelengths": [400.0, 410.0, "..."],
  "endmembers": [
    {
      "id": 1,
      "name": "Endmember 1",
      "pixel": {"row": 812, "col": 455},
      "coordinate": {"x": "...", "y": "..."},
      "spectrum": [0.081, 0.084, "..."],
      "purity_score": 0.97
    }
  ]
}

Optional auxiliary outputs include point/vector source locations, PPI/purity raster, CSV, spectral plot preview, and user-editable material labels.

10. Spectral Library Matching

Spectral Library Matching is the hyperspectral material-identification / whole-pixel classification tool. The user supplies or selects a reference spectral library, and each image pixel is compared against candidate reference spectra.

Image Spectrum + Reference Spectral Library ↓ Wavelength overlap check ↓ Library resampling to image spectral grid ↓ Optional identical preprocessing ↓ Matching Method ├─ SAM └─ SID ↓ Best matching material/class ↓ Class Raster + Match Score

10.1 Library preprocessing requirements

  • Reference wavelengths must overlap image wavelengths.
  • Wavelength units must be known and harmonized.
  • Library spectra should be resampled using wavelength/FWHM information when possible.
  • If image spectra are continuum-removed, derivative-transformed, or otherwise normalized, the reference library must receive the equivalent transformation.
  • Bad bands should be excluded from both image and reference spectra.

10.2 SAM — Spectral Angle Mapper

SAM treats each spectrum as a vector in N-dimensional band space and computes the angle between image spectrum x and reference spectrum s.

θ = cos−1 [ (x · s) / (||x||₂ ||s||₂) ]
x · s = Σi=1…Nxisi,    ||x||₂ = √(Σi=1…Nxi2)
  • θ ≈ 0: highly similar spectral direction.
  • Larger θ: less similar.
  • Best reference is typically the class with the smallest valid angle.
  • A maximum-angle threshold should allow pixels to remain unclassified.

Because SAM focuses on vector direction rather than magnitude, it can be relatively insensitive to overall albedo/illumination scaling when used with calibrated data; this does not remove the need for correct radiometric/atmospheric preprocessing.

Recommended SAM outputs

classification.tif
  0 = Unclassified
  1 = Material A
  2 = Material B
  ...

sam_best_angle.tif
  pixel value = minimum spectral angle

optional rule images:
  one angle band per reference material

10.3 SID — Spectral Information Divergence

SID converts nonnegative spectral vectors into probability-like distributions and measures their divergence using information theory.

Step 1 — normalize spectra

pi = xi / Σj=1…Nxj,    qi = si / Σj=1…Nsj

Step 2 — directional divergence

D(p || q) = Σi=1…N pi ln(pi/qi)
D(q || p) = Σi=1…N qi ln(qi/pi)

Step 3 — symmetric SID

SID(x,s) = D(p || q) + D(q || p)
  • SID close to 0: highly similar.
  • Larger SID: greater spectral divergence.
  • A maximum SID threshold should support an unclassified class.
Because the logarithm requires positive probability terms, implementations must define robust handling for zero, negative, NoData, or invalid reflectance values. A small ε floor may be used after a scientifically documented validity mask, rather than silently converting arbitrary negative values.

Recommended SID outputs

classification.tif
  best material/reference class

sid_best_score.tif
  minimum SID divergence

optional rule images:
  one SID score band per reference material

10.4 SAM vs SID

AspectSAMSID
Core ideaAngle between spectral vectorsInformation divergence between normalized spectral distributions
Best matchSmallest angleSmallest divergence
Output class mapYesYes
Reference libraryRequiredRequired
Zero/negative handlingVector norm must be validRequires careful positive-value handling for logarithms
ThresholdMaximum angleMaximum divergence

11. Spectral Unmixing

Spectral Unmixing estimates how much of each reference material/endmember contributes to a pixel. It is therefore a sub-pixel composition analysis, not a conventional hard classification.

11.1 Linear mixing model

For N spectral bands and K endmembers:

x = M a + ex ∈ ℝN = observed pixel spectrum; M ∈ ℝN×K = endmember matrix; a ∈ ℝK = abundance fractions; e = residual/error.

Expanded by wavelength:

xi = Σk=1…K Mikak + ei

11.2 Unconstrained least squares

â = arg mina ||x − Ma||22

When M has full column rank:

â = (MTM)−1MTx

Unconstrained solutions can contain negative abundances or sums different from 1.

11.3 Non-negative constraint

ak ≥ 0    for all k

11.4 Fully constrained linear unmixing

â = arg mina ||x − Ma||22
subject to   ak ≥ 0   and   Σk=1…Kak = 1

The constraints are often physically intuitive for fractional surface mixtures, but they are assumptions and may not fit every radiative process.

11.5 Output band count

Critical rule: the number of abundance bands follows the number of endmembers, not the number of input spectral bands.
Input hyperspectral raster = 200 bands
Endmembers = 6

Spectral Unmixing
        ↓

Output abundance raster = 6 bands

Band 1 = abundance Endmember 1
Band 2 = abundance Endmember 2
Band 3 = abundance Endmember 3
Band 4 = abundance Endmember 4
Band 5 = abundance Endmember 5
Band 6 = abundance Endmember 6

Example pixel:

Vegetation  = 0.62
Soil        = 0.23
Dry grass   = 0.08
Shadow      = 0.05
Other       = 0.02
-------------------
Total       = 1.00

11.6 Residual and RMSE

e = x − Mâ
RMSE = √[(1/N) Σi=1…N ei2]

A high residual/RMSE can indicate missing endmembers, nonlinear mixing, poor spectral alignment, uncorrected atmosphere, bad bands, or an endmember library that does not adequately represent the scene.

11.7 Unmixing after MNF

Unmixing can be performed in MNF space, but image and endmembers must be transformed by the same fitted MNF transformation. For platform defaults, physically interpretable abundance mapping is clearer in calibrated reflectance space, while MNF is used to improve endmember discovery and computational efficiency.

Recommended: 200-band Reflectance ↓ MNF (e.g. 20 informative components) ↓ Endmember Extraction → source pixel locations ↓ Sample original 200-band reflectance at those locations ↓ K endmember spectra × 200 wavelengths ↓ Unmix original/smoothed reflectance ↓ K abundance bands

12. Relationship Between the Seven Tools

FromCan FeedNotes
Spectral SmoothingDerivative, Continuum Removal, MNF, Endmember Extraction, Matching, Unmixing, ML/DLPreserves wavelength domain.
Spectral DerivativeMatching, ML/DL, feature analysisReference library must use equivalent derivative for matching.
Continuum RemovalMatching, feature analysis, ML/DLUse the same spectral window on reference spectra.
MNFEndmember Extraction, ML/DL, advanced unmixingComponents are not wavelengths.
Endmember ExtractionLibrary Matching, Spectral UnmixingEndmembers may first need material identification.
Library MatchingFinal class/material analysis, GIS statisticsNot a prerequisite for Unmixing.
Spectral UnmixingAbundance analysis, thresholding, ML/DL, dominant-material derivationOutput bands are abundance dimensions.

12.1 Valid workflows

Surface Reflectance → Smoothing → SAM/SID

Surface Reflectance → Smoothing → Continuum Removal → SAM/SID

Surface Reflectance → Smoothing → Derivative → Random Forest

Surface Reflectance → MNF → Random Forest

Surface Reflectance → MNF → Endmember Extraction
                    → sample original spectra
                    → Spectral Unmixing

Surface Reflectance → Endmember Extraction → SAM/SID

External Spectral Library → resample to image wavelengths → SAM/SID

12.2 Workflow to avoid by default

Spectral Unmixing → SAM/SID spectral-library matching   ✕

After unmixing, the bands represent abundance of endmembers rather than wavelength samples.

13. Recommended Platform Output Contract

ToolMain FileSidecar / AuxiliaryLayer Type
SmoothingFloat32 COG, N bands.statistics.jsonRaster
DerivativeFloat32 COG, N bands.statistics.json + derivative metadataRaster
Continuum RemovalFloat32 COG, N bands.statistics.json + spectral rangeRaster
MNFFloat32 COG, M bands.statistics.json + MNF transform/statistics metadataRaster
Endmember Extractionendmembers.jsonCSV, optional point layer, optional purity rasterNon-raster primary result
Library MatchingInteger class COGconfidence/score COG, class legend JSONRaster classification
UnmixingFloat32 COG, K bands.statistics.json + endmember legend + RMSE/residual optionalRaster abundance

13.1 Suggested endmember JSON fields

  • analysis/method/version;
  • source raster identifier;
  • spectral domain and wavelength units;
  • wavelength array;
  • endmember identifier and optional material label;
  • source pixel row/column and geospatial coordinate;
  • spectral vector;
  • purity/quality score where available;
  • preprocessing history;
  • bad-band list;
  • creation timestamp.

13.2 Suggested classification legend

{
  "classes": [
    {"value": 0, "name": "Unclassified"},
    {"value": 1, "name": "Kaolinite", "reference_id": "lib-001"},
    {"value": 2, "name": "Calcite", "reference_id": "lib-021"},
    {"value": 3, "name": "Vegetation", "reference_id": "lib-104"}
  ],
  "method": "SAM",
  "score_semantics": "lower_is_better"
}

13.3 Suggested abundance metadata

{
  "bands": [
    {"band": 1, "endmember": "Vegetation", "unit": "fraction"},
    {"band": 2, "endmember": "Soil", "unit": "fraction"},
    {"band": 3, "endmember": "Shadow", "unit": "fraction"}
  ],
  "constraint": "FCLS",
  "sum_to_one": true,
  "nonnegative": true
}

14. Validation & Quality Control

14.1 Common validation

  • Reject empty rasters and invalid band dimensions.
  • Verify NoData behavior and finite-value proportion.
  • Verify wavelength array length equals raster band count.
  • Check wavelengths are monotonically ordered or explicitly reorder data and metadata together.
  • Detect duplicate wavelengths.
  • Apply declared scale/offset before physics-based spectral analysis.
  • Exclude known bad bands and strong atmospheric-absorption regions when appropriate.

14.2 Smoothing QC

  • Window cannot exceed valid spectral range.
  • Savitzky–Golay window must be compatible with polynomial order.
  • Report edge policy.

14.3 Derivative QC

  • Reject zero wavelength spacing.
  • Handle irregular wavelength spacing explicitly.
  • Record derivative order and units.

14.4 MNF QC

  • Noise covariance must be numerically valid.
  • Regularize near-singular covariance matrices.
  • Return eigenvalues/component-quality information.
  • Do not label MNF components as wavelengths.

14.5 Endmember QC

  • K must be smaller than or consistent with effective spectral dimensionality.
  • Report duplicate/highly similar extracted endmembers.
  • Report source pixels and validity masks.
  • Allow user to rename “Endmember 1” after interpretation.

14.6 Matching QC

  • Require spectral overlap.
  • Resample library to image spectral grid.
  • Use threshold to avoid forced classification.
  • Return best score and optionally second-best score/margin.
  • For SID, handle nonpositive values explicitly.

14.7 Unmixing QC

  • Endmember count K must normally be less than number of spectral dimensions used.
  • Endmember and image spectral dimensions must match exactly after resampling/transformation.
  • Return residual or RMSE.
  • For constrained methods, report abundance-sum deviation and negative-value violations.

15. Implementation Notes for an Analysis Server

15.1 Processing strategy

A hyperspectral cube can be hundreds of bands and several gigabytes. Algorithms should use block/window processing where mathematically possible. Do not read a full cube into RAM unless required and size-checked.

ToolWindow/Block Friendly?Global Preparation Needed?
SmoothingYesNo, except metadata
DerivativeYesNo, except wavelength array
Continuum RemovalYes, pixel blocksNo
MNFTransform yesNoise/covariance statistics first
Endmember ExtractionMethod dependentOften sampling/reduction/global search
SAM/SIDYesReference resampling/preprocessing first
UnmixingYesEndmember matrix/solver setup first

15.2 Dtype

  • Use Float32 for transformed spectral/abundance outputs unless higher precision is specifically required.
  • Use integer type for class raster, choosing UInt8/UInt16/UInt32 based on class count.
  • Do not encode transformed physical values into integers unless scale/offset is explicit.

15.3 Raster statistics

A statistics sidecar should describe each output band correctly. For a 200-band cube this can be large; the implementation may store per-band min/max/mean/std plus sampled histograms. MNF and abundance outputs should have semantic band descriptions.

15.4 Provenance

{
  "input_domain": "surface_reflectance",
  "operations": [
    {"tool": "spectral_smoothing", "method": "savitzky_golay", "window": 7, "order": 2},
    {"tool": "continuum_removal", "range_nm": [2000, 2400]}
  ]
}

Provenance is essential because a reference library must receive compatible preprocessing before matching.

15.5 Do not silently change spectral semantics

OutputBand semantics
Smoothed cubeWavelength
Derivative cubeDerivative at wavelength
Continuum-removed cubeNormalized value at wavelength
MNF rasterMNF component
SAM/SID class rasterClass ID
Unmixing rasterEndmember abundance

16. Example Analytical Workflows

16.1 Mineral identification from reflectance

Surface Reflectance
      ↓
Remove bad bands
      ↓
Spectral Smoothing
      ↓
Continuum Removal (target SWIR range)
      ↓
Resample mineral spectral library to image wavelengths
      ↓
Apply same continuum removal to library
      ↓
Spectral Library Matching — SAM or SID
      ↓
Mineral Class Map + Match Score

16.2 Endmember discovery and abundance mapping

Surface Reflectance (200 bands)
      ↓
MNF (retain 20 informative components)
      ↓
PPI / VCA / N-FINDR
      ↓
K pure-pixel locations
      ↓
Sample original 200-band reflectance
      ↓
K endmember spectra
      ↓
Fully Constrained Linear Spectral Unmixing
      ↓
K abundance bands + RMSE

16.3 Vegetation stress feature engineering

Surface Reflectance
      ↓
Spectral Smoothing
      ↓
First Derivative
      ↓
Selected spectral features / ML
      ↓
Random Forest / SVM / Deep Learning

16.4 Direct spectral-library classification

Surface Reflectance
      +
Reference Library
      ↓
Spectral resampling
      ↓
SAM / SID
      ↓
Class Raster
      +
Best-Match Score Raster

16.5 Why Unmixing and Matching are parallel

Matching result

Pixel 100,200
→ Kaolinite

One dominant material identity, subject to threshold and library design.

Unmixing result

Pixel 100,200
Kaolinite = 0.58
Calcite   = 0.27
Soil      = 0.15

Fractional composition. Multiple materials can coexist in the same pixel.

17. Scientific & Technical References

Primary papers and official technical documentation used to ground the definitions and implementation notes.

  1. Savitzky, A. & Golay, M. J. E. (1964). Smoothing and Differentiation of Data by Simplified Least Squares Procedures. Analytical Chemistry 36(8), 1627–1639. ACS.
  2. NV5 Geospatial / ENVI. Continuum Removal. Official documentation.
  3. NV5 Geospatial / ENVI. Minimum Noise Fraction Transform. Official documentation.
  4. NV5 Geospatial / ENVI. Forward MNF Transform Task. Official documentation.
  5. NV5 Geospatial / ENVI. Pixel Purity Index. Official documentation.
  6. Nascimento, J. M. P. & Bioucas-Dias, J. M. (2005). Vertex Component Analysis: A Fast Algorithm to Unmix Hyperspectral Data. IEEE Transactions on Geoscience and Remote Sensing 43(4), 898–910. IEEE.
  7. NV5 Geospatial / ENVI. SMACC Endmember Extraction. Official documentation.
  8. NV5 Geospatial / ENVI. Spectral Angle Mapper. Official documentation.
  9. Chang, C.-I. (2000). An Information-Theoretic Approach to Spectral Variability, Similarity, and Discrimination for Hyperspectral Image Analysis. IEEE Transactions on Information Theory 46(5), 1927–1932. IEEE.
  10. NV5 Geospatial / ENVI. Material Identification Tool — SAM, SID and spectral-library resampling. Official documentation.
  11. NV5 Geospatial / ENVI. Linear Spectral Unmixing. Official documentation.
  12. U.S. Geological Survey. USGS Spectral Library. Official USGS resource.
  13. U.S. Geological Survey. USGS Spectral Library Version 7 Data. Official data release.
  14. NV5 Geospatial / ENVI. Spectral Hourglass Workflow. Official documentation.
Implementation principle: the formulas in this document define the scientific contract. Exact numerical behavior still depends on choices such as edge handling, noise estimation, spectral resampling, regularization, thresholds, constraints and invalid-value policy. Those choices should be explicit in analysis parameters and provenance.