C06 · Color and spectra
More than three channels
A spectral image stores measurements over wavelength bands, not merely many RGB colours.
Background if needed
Theory
Axes of a spectral cube
A cube has x, y and a spectral axis. Bands have centres and response widths; closely spaced narrow bands describe spectra more finely. No universal band-count threshold separates multi- and hyperspectral; measurement design matters. Time and medical-volume depth are different axes, not wavelength.
Radiance depends on illumination and the path to the instrument. Reflectance needs dark/white references and calibration; atmospheric and absorption bands may be invalid. Missing data must not become a measured zero.
Imagine eight aligned gray images, one per band. A site at the same coordinates supplies eight values: a small spectral cube. The next experiment opens one actual cube plane on the left and assembles screen RGB from three planes on the right. Reassigning bands changes neither acquisition nor missing bands in a photograph.
Three bands on a screen
Assign three bands to R, G and B. Including infrared produces false colour: useful coding, not natural photography. Band ratios and NDVI emphasize differences under stated assumptions.
A small denominator, clouds, shadows and poor calibration make an index unreliable. One index does not determine plant species or field health. The eight bands and three spectra below are entirely authored for the lesson.
See what RGB leaves out
Change the band for R: its separate gray plane appears on the left and the composite on the right. Switch the result channel to G or B to follow another band. Select three materials and compare their spectra.
Exact values are in the point inspector
Grayscale 0…1: black to white.
- Assign a measurement to a screen channel
Exact values are in the point inspector
RGB; display range 0…1
Inspect the selected point
What the plot shows
Select another image region: the curve shows its eight measurements. R/G/B markers identify the three wavelengths currently assigned to the screen.
- Vegetation
- R: 750
- G: 650
- B: 500
Composite colour follows band assignment. Red in false colour need not be red in reality.
Parameters and details
All spectra are authored, not instrument measurements. Eight bands are defined independently of RGB. Assigning infrared to a visible channel gives false colour. The two-endmember model uses known spectra with fractions summing to 1. An optional third material replaces a share of the whole original mixture; fixed band errors test fitting robustness.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Material mixtures and residuals
A pixel may cover several materials. A linear mixture combines known endmember spectra using nonnegative fractions summing to 1. Fitting fractions is not classification. Residual shows whether the model fits.
The graph shows two references, the true mixture and your estimate. One slider estimates the vegetation fraction; the second material supplies the remainder to 1. When curves agree in every band, residual is zero. Real nonzero residuals can indicate noise or the wrong material set.
First fit zero residual in the exact model. Then add a third material or measurement error in the additional controls and refit. Residual may remain: the slider explores only mixtures of the chosen two references. The calculation shows two reference samples for one band, their fractions and the prediction; the observed curve tests whether that model fits.
A two-material spectrum
Set a true fraction and fit an estimate. Residual uses all eight bands, not appearance alone.
Exact values are in the point inspector
Grayscale 0…1: black to white.
- Compare prediction with measurement
Exact values are in the point inspector
RGB; display range 0…1
Inspect the selected point
What the plot shows
Change the estimated fraction: its predicted curve must match the true mixture across all eight bands. Matching one screen colour is insufficient.
- Vegetation
- Dry material
- Observed mixture
- Your estimate
- R: 750
- G: 650
- B: 500
Matching fractions gives zero residual in the exact model. Noise, unknown materials and nonlinearity can prevent this in reality.
- RMS residual
- 0.0304
Parameters and details
All spectra are authored, not instrument measurements. Eight bands are defined independently of RGB. Assigning infrared to a visible channel gives false colour. The two-endmember model uses known spectra with fractions summing to 1. An optional third material replaces a share of the whole original mixture; fixed band errors test fitting robustness.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Reference: from spectra to features
Reference and further methods
Spectral angle compares spectral-vector direction, reducing sensitivity to a common multiplier. PCA finds directions of greatest variation; MNF first accounts for a noise model. These solve other problems, not recovery of measurements from RGB. They are not presented as implemented algorithms here; the computed model above is only a linear mixture of two known references.
Practice
Test the idea under another condition. Follow the task above the images; point inspection helps explain the result. This exploration is not scored.
Fit every band
Fit the fraction across all eight bands without reading the true fraction. Check that the curves agree. Add a third material and find the lowest residual: explain why it remains positive despite the best fraction.
Exact values are in the point inspector
Grayscale 0…1: black to white.
- Compare prediction with measurement
Exact values are in the point inspector
RGB; display range 0…1
Inspect the selected point
What the plot shows
Change the estimated fraction: its predicted curve must match the true mixture across all eight bands. Matching one screen colour is insufficient.
- Vegetation
- Dry material
- Observed mixture
- Your estimate
- R: 750
- G: 650
- B: 500
Matching fractions gives zero residual in the exact model. Noise, unknown materials and nonlinearity can prevent this in reality.
- RMS residual
- 0.1116
Parameters and details
All spectra are authored, not instrument measurements. Eight bands are defined independently of RGB. Assigning infrared to a visible channel gives false colour. The two-endmember model uses known spectra with fractions summing to 1. An optional third material replaces a share of the whole original mixture; fixed band errors test fitting robustness.
Select an image point. Arrows move it; Home and End reach row edges. Viewing does not change the calculation.
Changing the example requires JavaScript and Canvas. Computed images remain available above.
Games
Test your explanation
Question 1 of 5
Vegetation is bright in the 800 nm band. What does the bright cell mean?
Exact values are in the point inspector
Grayscale 0…1: black to white.
Exact values are in the point inspector
RGB; display range 0…1
Exact values are in the point inspector
RGB; display range 0…1
Exact values are in the point inspector
RGB; display range 0…1
Exact values are in the point inspector
RGB; display range 0…1
Exact values are in the point inspector
RGB; display range 0…1
Choose one answer. It is checked immediately.
Limitations and references
Limits of this example
Eight illustrative 450–800 nm bands and three authored spectra. No satellite-cube import, atmospheric correction or real-material identification.