Appendix D Quality and Drift Metrics (Imaging)
One-Sentence Goal
Specify a minimal, executable convention for consistent quality and drift evaluation across the imaging chain—spanning radiometry, optics, sampling, noise, geometry, color, HDR, computational imaging, and timebase/arrival—using a unified window Delta_t, robust aggregation, and actionable alert thresholds.
I. Scope & Targets
- Covered artifacts: metrics.img.* and drift.img.* for Image, Cube, EventStream, ToFDepth and derivatives.
- Inputs: linear-domain imagery with references (Ref*: flat/dark, geometric/color calibration, MTF baselines, temporal anchors).
- Outputs: windowed statistics, quantiles, robust trends, and drift alerts, persisted into manifest.img (Appendix C) and contracts C20-* (Appendix B).
II. Terms & Variables
- Time & windows: ts, tau_mono, Delta_t, EWMA, CUSUM, p95/p99.
- Radiometry & noise: SNR, PSNR, SSIM, NPS(f), sigma_read, k_shot, PRNU, DSNU.
- Optics & sampling: MTF(f), f50, f80, MTF_area, alias_ratio.
- Geometry & registration: K, R, t, pi(•), err_reproj.
- Color: DeltaE00, illuminant, matrix_3x3, gray_balance_err.
- HDR / computational: ghosting, saturation_ratio, residual_l2.
- Timebase / arrival: offset, skew, J_p99, T_arr_form1, T_arr_form2, delta_form.
- Distribution drift: W1, KL, drift_slope, drift_level.
- Units & dimensions: unit(x), dim(x); default image units are DN or W•sr^-1•m^-2; spatial frequency in cy/pixel.
III. Axioms P20D-*
- P20D-1 (Linear-domain baseline): compute all physics-grounded metrics in space="linear"; run check_dim(expr) prior to publication.
- P20D-2 (Window consistency): evaluate drift with a unified sliding window Delta_t and robust aggregation (median and high quantiles).
- P20D-3 (Timebase primacy): account trends on tau_mono; map to ts for publication with offset/skew/J.
- P20D-4 (Traceable references): metrics that compare against a baseline must carry RefID and RefCond.
- P20D-5 (Two-form arrival): any arrival-related quality criterion must record T_arr_form1, T_arr_form2, delta_form.
- P20D-6 (Streaming-friendly): online estimators support EWMA and CUSUM with O(1) space.
IV. Minimal Equations S20D-*
- S20D-1 (Radiometric SNR): SNR = ( mu_signal - mu_dark ) / sigma_total (aggregated by median within the window); unit(SNR) = "-".
- S20D-2 (Peak SNR):
PSNR = 10 * log10( max_I^2 / MSE ),MSE = ( 1 / N ) * ( ∑ ( x_i - y_i )^2 )。 - S20D-3 (Structural similarity):
SSIM = ( ( 2 * mu_x * mu_y + C1 ) * ( 2 * sigma_xy + C2 ) ) / ( ( mu_x^2 + mu_y^2 + C1 ) * ( sigma_x^2 + sigma_y^2 + C2 ) )。 - S20D-4 (Fixed-pattern noise): PRNU = std( flat_norm ) / mean( flat_norm ) ; DSNU = std( dark ).
- S20D-5 (Noise power spectrum):
NPS(f) = ( | FFT( w ∘ n ) |^2 ) / ( N * dx * dy ) — declare window w and sampling steps dx, dy. - S20D-6 (Modulation transfer):
f50 = argmin_f { MTF(f) ≤ 0.5 },MTF_area = ( ∫_0^{f_c} MTF(f) df ) with explicit df and cutoff f_c. - S20D-7 (Geometric reprojection error):
err_reproj = ( 1 / M ) * ( ∑ || p_i - pi( K, R, t, P_i ) ||_2 ) (pixels). - S20D-8 (Color difference):
DeltaE00_p95 = p95( DeltaE00( img, ref ) ) under a specified color space and illuminant. - S20D-9 (HDR artifacts & saturation):
ghosting = mean( | grad( E_est ) - grad( E_ref ) | ) ; saturation_ratio = ( # { x | img(x) ≥ max_I } ) / N. - S20D-10 (Arrival-time jitter):
J_p99 = p99( | ts - map( tau_mono ) | ) with map(•) the timebase mapping. - S20D-11 (Wasserstein-1 drift):
W1( P, Q ) = ( ∫ | F_P(z) - F_Q(z) | dz ) (histogram approximation with bin measure dz). - S20D-12 (EWMA trend):
EWMA_t = lambda * x_t + ( 1 - lambda ) * EWMA_{t-1 },sigma_EWMA = sigma_hat * sqrt( lambda / ( 2 - lambda ) )。 - S20D-13 (CUSUM change-point):
C_plus = max( 0, C_plus_{t-1} + x_t - ( mu_0 + k ) ),C_minus = max( 0, C_minus_{t-1} - x_t + ( mu_0 + k ) ) with threshold h. - S20D-14 (Drift slope):
drift_slope(x) = argmin_a,b ( ∑_t rho( x_t - ( a * t + b ) ) ) where rho is a robust loss (e.g., Huber).
V. Workflow M20-D*
- Feature extraction: compute SNR/PSNR/SSIM/NPS/MTF in space="linear"; evaluate DeltaE00 in the registered color space; produce err_reproj, ghosting/saturation_ratio, J_p99.
- Window aggregation: within Delta_t, compute median/p95/p99/IQR and W1/KL; form metrics.win.*.
- Online updates: maintain EWMA/CUSUM and drift_slope; output drift.level, drift.trend, drift.alert.
- Contract evaluation: feed metrics to C20-* (Appendix B) and generate a report with labels.
- Persist & sign: write manifest.img.sli.*, metrics.img.*, contracts.*; apply hash_sha256(blob) and signature.
VI. Contracts & Assertions (Example Mapping)
- C20-501 (MTF baseline): assert( f50 ≥ f50_min ) and assert( | f50 - f50_ref | ≤ tol_f50 ).
- C20-601 (Color consistency): assert( DeltaE00_p95 ≤ tol_E00 ).
- C20-701 (Noise boundaries): assert( PRNU ≤ prnu_max ) and assert( DSNU ≤ dsnu_max ).
- C20-801 (HDR stability): assert( ghosting ≤ tol_ghost ) and assert( saturation_ratio ≤ sat_max ).
- C20-901 (Timebase & arrival): assert( J_p99 ≤ J_max ) and assert( delta_form ≤ tol_Tarr ).
- C20-1001 (Drift slope): assert( | drift_slope(x) | ≤ tol_slope_x ) for key x ∈ { f50, DeltaE00_p95, PRNU, err_reproj }.
VII. Bindings I20-*
- I20-201 compute_quality_metrics(img, refs, cfg) -> metrics — emit the S20D-* atomic set.
- I20-202 update_drift_state(state, metrics, Delta_t) -> state' — maintain EWMA/CUSUM/robust trend.
- I20-203 evaluate_img_contracts(metrics, policy) -> report — execute C20-* and return alerts.
- I20-204 emit_qpanel(metrics, drift, report) -> panel — synthesize the sli.* quality panel.
VIII. Cross-References
- Optics & MTF/OTF/MTF_area: Chapter 5.
- Sampling & reconstruction impacts on alias_ratio/SSIM: Chapter 6.
- Noise & PRNU/DSNU/NPS: Chapters 7–8.
- Geometry & err_reproj: Chapter 9.
- Color & DeltaE00: Chapter 10.
- HDR & ghosting/saturation_ratio: Chapter 11.
- Computational residuals & robustness: Chapter 12.
- Time/path gating & J_p99/delta_form: Chapter 13.
- Contract library & policy cards: Appendix B; manifest mapping: Appendix C; interfaces: Appendix A.
IX. Audit & Rollback
- Persist EWMA and CUSUM streams; trigger tiered alerts and automated rollback with level ∈ { info, warn, fail }.
- Quarantine failing samples and freeze the current Ref* pointer; record TraceID and RefCond.
Summary
This appendix standardizes metrics.img.* and drift.img.*—their computation windows, robust aggregation, online estimation, and contract coupling—so that quality and drift assessments remain consistent, traceable, and operationally actionable across modalities and scenarios.