Chapter 10 Color Management and White Balance


One-Sentence Goal
Establish an auditable color pipeline from the sensor linear domain to a target color space; perform scene/view–consistent white-point estimation, chromatic adaptation, CCM solving, and rendering; and control stability for ΔE, skin tones, and neutral gray via metrics and contracts.


I. Scope & Targets

  1. Inputs
    • Raw imaging & metadata: RGB_raw (Bayer / multispectral), ts | tau_mono, ISO, exposure, T_cam, gain_map, lens & filter descriptors.
    • Calibration & references: color-chart observations { patch_j }, reference illuminant or SPD E(λ), sensor spectral sensitivities S_c(λ), reference white W_ref.
    • Target color space & transfer: dst_cs ∈ { sRGB, DisplayP3, Rec.2020, ACEScg, ProPhotoRGB }, TRC/OETF.
  2. Outputs
    • White balance: wb = diag(g_R, g_G, g_B) or tile-wise wb(x,y); illuminant estimate illuminant = { CCT, Tint or W_src }.
    • Color transforms: M_ccm, chromatic adaptation CAT(W_src→W_dst), and the rendering matrix
      M_render = M_dst * CAT * M_ccm * wb.
    • Artifacts & manifest: profile.v1 (models + coefficients), manifest.imaging.color, hash_sha256(profile), signature.
  3. Applicability
    • Perform white balance in the RAW linear domain before demosaicing; multi-modal/multi-resolution pipelines share a single white point but may use independent M_ccm.
    • Dual / mixed illuminants may use zonal estimation or soft segmentation; publish the strategy and masks.

II. Terms & Variables

  1. Physics & perception
    • E(λ): scene spectral power distribution; R(λ): surface reflectance; S_c(λ): sensor spectral sensitivity.
    • W = (X_w, Y_w, Z_w): white point; XYZ, Lab are CIE spaces; u'v' chromaticity.
  2. Camera & matrices
    • RGB_raw_lin: RAW after dark/PRNU/DSNU correction (linear).
    • wb = diag(g_R,g_G,g_B): white-balance gain matrix.
    • M_ccm ∈ R^{3×3}: camera-to-XYZ (scene-referred).
    • CAT(W_s→W_d) = M^{-1} * diag( W_d / W_s ) * M (Bradford/Von Kries family).
    • M_dst: XYZ → target RGB (linear) for dst_cs.
    • TRC/OETF: target system tone/gamma mapping.
  3. Metrics
    • ΔE_ab (CIE76), ΔE_00 (CIEDE2000); err_awb (white-point residual in u'v').
    • gamut_viol: gamut overflow ratio; skin_angle: deviation of skin hue angle.
  4. Units & dimensions
    unit(RGB_raw_lin)="a.u.", unit(XYZ)="a.u." (relative); unit(CCT)="K"; check_dim must pass.

III. Axioms P210- (Color & WB Baseline)*


IV. Minimal Equations S210-*


V. Pipeline & Operational Flow M100-*

  1. M100-1 Readiness: Apply dark/flat and fixed-pattern corrections (Chapter 8) to get RGB_raw_lin; verify unit/dim.
  2. M100-2 White-point estimation: prioritized strategy:
    • Highlight / gray-card detection (with geometric/radiometric checks),
    • Gray-world / Gray-edge,
    • Learning-based illuminant_net (for low-light / mixed light).
      Output W_src, wb, and confidence.
  3. M100-3 Linear WB: RGB_wb = wb * RGB_raw_lin (RAW domain; map Bayer channels per CFA layout).
  4. M100-4 CCM selection / interpolation: Choose or interpolate M_ccm using CCT/D_uv, T_cam, ISO.
  5. M100-5 Chromatic adaptation: Compute CAT(W_src→W_dst) to obtain XYZ_d.
  6. M100-6 Target color-space mapping: RGB_dst_lin = M_dst^{-1} * XYZ_d; apply gamut_map (prefer compression, then clip).
  7. M100-7 Transfer & rendering: Apply OETF/TRC, optional local tone mapping; embed ICC/DNG tags and export profile.v1.
  8. M100-8 Quality assessment: On chart and skin ROIs, compute ΔE_00, err_awb, gamut_viol, skin_angle.
  9. M100-9 Contracts & fallback: On assertion failure, fall back to a conservative configuration or publish WB + XYZ only.
  10. M100-10 Persistence & signature: Emit manifest.imaging.color, recording matrices, white point, TRC, metrics, and signature.

VI. Contracts & Assertions


VII. Implementation Bindings I100-*


VIII. Cross-References


IX. Quality Metrics & Risk Control

  1. Core indicators
    • mean/p95(ΔE_00), err_awb(u'v'), gamut_viol, skin_angle, cond(M_render), artifact_rate.
    • Runtime monitoring: within window Delta_t, track drift_g_R,B, drift_CCT, slope of ΔE_00, and alerts.
  2. Key risks & playbooks
    • Mixed illuminants: partitioned AWB + feathered fusion; on failure, fall back to gray-world with low-confidence tagging.
    • High gain / saturation: constrain WB caps and normalize via G channel; enable highlight protection if needed.
    • Observer mismatch: switch to ACEScg working space and publish observer-difference notes.
    • Config drift: maintain versioned mapping { CCT, T_cam } -> { wb, M_ccm } with regression/interpolation.
    • Algorithm instability: if cond(M) exceeds threshold, switch to LUT-based rendering or lower-order matrices.

Summary
This chapter codifies the minimal closed loop for color management—RAW → wb → M_ccm → CAT → M_dst^{-1} → TRC—and enforces contracts via ΔE, white-point residuals, gamut overflow, and skin-hue angle. Artifacts are published as profile.v1 and manifest.imaging.color, ensuring consistent, auditable rendering across devices and scenes.