Appendix B Contract Library and Policy Cards (Imaging)
One-Sentence Goal
Define standardized imaging contracts C20-* and instantiable policy cards that span acquisition → publication, enabling automated assertions, SLO guardrails, and auditable traceability.
I. Scope & Targets
- Covered artifacts: Image, Cube, EventStream, ToFDepth and their derivatives; metadata and manifests; quality panels SLI.img.* and SLI.svc.*.
- Input-side constraints: device/mode registration present (Chapter 3; I20-01/02), metrology in the linear domain (Chapter 4), unified time base on tau_mono (Chapter 13).
- Output-side constraints: all assertions are instantiated via policy-card thresholds and persisted/signed with I20-113 emit_qc_manifest.
II. Terms & Notation
- Metrology & units: unit(x), dim(x), check_dim(expr).
- Time & arrival: ts, tau_mono, T_arr, c_ref, n_eff, delta_form, explicit paths/measures ( ∫_{gamma(ell)} • d ell ).
- Optics & sampling: PSF, OTF, MTF(f), f50, f80, MTF_area.
- Noise & FPN: NoiseModel{ sigma_read, k_shot, NPS(f) }, PRNU, DSNU.
- Geometry & color: GeomModel{ K,R,t,dist }, ColorProfile{ M, curve, illuminant }, DeltaE_00.
- Runtime & SLO: rho, W_q, P99, drop_rate, TS.sli.*.
III. Contract Taxonomy & Numbering
Unified numbering: C20-xxx, grouped by topic:- 00x Metadata & time-base unification
- 10x Linear radiometry & unit/dimension
- 20x Optical resolution & transfer functions
- 30x Sampling, reconstruction & interpolation
- 40x Noise modeling & denoising quality
- 50x Flat/dark & fixed-pattern noise
- 60x Geometry calibration & registration
- 70x Color management & white balance
- 80x HDR & exposure fusion
- 90x Computational imaging robustness
- 100x Time/path gating & arrival time
- 110x Quality panel & release freeze
IV. Standard Contract Set C20-* (Assertions)
- Metadata & time base (C20-00x)
- C20-001 meta_complete: required keys present; check_dim(expr) runnable; unique(pk) passes.
- C20-002 timebase_aligned: record offset/skew/J; assert |offset| ≤ tol_offset, |skew| ≤ tol_skew, J.P99 ≤ tol_jitter.
- C20-003 arrival_two_forms: compute both
T_arr = ( 1 / c_ref ) * ( ∫ n_eff d ell ) and T_arr = ( ∫ ( n_eff / c_ref ) d ell ); assert delta_form ≤ tol_Tarr.
- Radiometry & units (C20-10x)
- C20-101 linear_domain: space="linear"; dark/gain corrected by linearize_and_calibrate.
- C20-102 unit_dim_consistent: all fields declare unit, dim and pass check_dim( y - f(x) ).
- C20-103 flat_dark_stability: flat mean drift ≤ tol_flat_drift; dark noise ≤ tol_dark_sigma.
- C20-104 radiometric_monotonic: response monotonic, d y_lin / d exposure ≥ 0 almost everywhere.
- Optical resolution (C20-20x)
- C20-201 mtf_f50_min: f50 ≥ f50_min.
- C20-202 psf_normalized: ( ∫ PSF dA ) = 1 and PSF ≥ 0.
- C20-203 otf_support: OTF(f) leakage beyond cutoff ≤ tol_otf_leak.
- Sampling & reconstruction (C20-30x)
- C20-301 demosaic_artifact: zipper/maze artifact_score ≤ tol_demosaic_art.
- C20-302 resample_aliasing: alias energy ratio alias_ratio ≤ tol_alias.
- C20-303 superres_gain: MTF_area(gain_band) ≥ gain_sr_min and ringing ≤ tol_ringing.
- Noise & denoising (C20-40x)
- C20-401 noise_model_fit: NoiseModel regression R2 ≥ tol_noise_R2.
- C20-402 nps_band_limit: band-limited NPS_band.P95 ≤ tol_NPS_band.
- C20-403 detail_preserve: detail-preservation index DPI ≥ tol_DPI.
- FPN & correction (C20-50x)
- C20-501 prnu_limit: PRNU ≤ tol_PRNU.
- C20-502 dsnu_limit: DSNU ≤ tol_DSNU.
- C20-503 bad_pixel_rate: mask_ratio ≤ tol_badpix.
- Geometry & registration (C20-60x)
- C20-601 reproj_error: reprojection err_geo ≤ tol_geo.
- C20-602 distortion_residual: post-undistort residual ≤ tol_dist_res.
- C20-603 multimodal_reg: registration error ≤ tol_reg or MI gain ≥ tol_MI_gain.
- Color & white balance (C20-70x)
- C20-701 color_accuracy: DeltaE_00.P95 ≤ tol_dE95, DeltaE_00.P99 ≤ tol_dE99.
- C20-702 wb_gray_error: neutral-gray deviation ≤ tol_wb_gray.
- C20-703 gamut_clip_ratio: out-of-gamut fraction ≤ tol_oog_ratio.
- HDR & exposure fusion (C20-80x)
- C20-801 hdr_ghosting: ghosting ≤ tol_ghost.
- C20-802 saturation_ratio: saturated-pixel ratio ≤ tol_sat_ratio.
- C20-803 local_contrast_consistency: local-contrast deviation ≤ tol_lcc.
- Computational imaging robustness (C20-90x)
- C20-901 deconv_condition: condition number ≤ tol_cond and iterations ≤ tol_iter.
- C20-902 cs_residual: residual || y - Phi x ||_2 ≤ tol_cs_res.
- C20-903 sharpening_ringing: over-sharpen ringing ≤ tol_sharp_ring.
- Time/path gating & arrival (C20-100x)
- C20-1001 gate_window_bound: Δt ≤ tol_gate_width.
- C20-1002 sync_quality: sync score S_sync ≥ tol_sync.
- C20-1003 arrival_consistency: delta_form ≤ tol_Tarr (two-form parallelism as above).
- Quality panel, SLO & release (C20-110x)
- C20-1101 latency_p99: T_proc.P99 ≤ tol_P99.
- C20-1102 drop_rate_bound: drop_rate ≤ tol_drop.
- C20-1103 utilization_stable: rho < 1 and W_q.P95 ≤ tol_Wq.
- C20-1104 manifest_signed: hash_sha256(blob) and signature present and match.
V. Policy Card Template & Example
- Template (PolicyCard-IMG)
- version: IMG-v1
- profile: <Lab|Prod|Edge>
- device_id/mode_id: <string>
- refs: <charts|flats|darks|psf|color_profile>
- tolerances: { tol_offset, tol_skew, tol_jitter, tol_Tarr, f50_min, tol_PRNU, tol_DSNU, tol_geo,
- tol_dE95, tol_dE99, tol_ghost, tol_P99, tol_drop, ... }
- bands: { mtf_band, nps_band, gain_band }
- gates: { Delta_t_max, S_sync_min }
- runtime: { rho_max, W_q_P95_max }
- degrade_policy: { on_violation: <drop|recompute|fallback>, max_retries, notify }
- Example (fragment): Prod-DSLR-4K-v1
- profile: Prod
- tolerances:
- f50_min: 0.25 cy/pixel
- tol_PRNU: 0.01
- tol_DSNU: 1.5 DN
- tol_dE95: 2.0
- tol_dE99: 3.5
- tol_geo: 0.3 px
- tol_ghost: 0.05
- tol_Tarr: 1e-9 s
- tol_P99: 25 ms
- tol_drop: 0.005
- degrade_policy: { on_violation: fallback, max_retries: 1, notify: ops@etl }
VI. Assertions & Bindings
- Entry point: assert_contract(ds|img, C20-*, policy)—invoked post-node and pre-release in the pipeline.
- Bindings:
- Call Methods.Cleaning v1.0 I10-10 assert_contract for generic assertions;
- Imaging-specific metrics are produced by this volume’s I20-21/22/41/51/61/71/81/91/101/112/113, then compared by the assertion engine to the policy card.
- Return semantics: { pass, violations[], sli, audit_report }; severe violations trigger degrade_policy and rollback paths.
VII. Cross-References
Linearization & units (Ch. 4: C20-101/102/103/104); Optics & sampling (Chs. 5–6: C20-201/202/203/301/302/303); Noise & FPN (Chs. 7–8: C20-401/402/403/501/502/503); Geometry & color (Chs. 9–10: C20-601/602/603/701/702/703); HDR & CI (Chs. 11–12: C20-801/802/803/901/902/903); Time/path gating & arrival (Ch. 13: C20-1001/1002/1003); Quality & audit (Ch. 14: C20-1101/1102/1103/1104).
Timebase, two-form arrival, release freeze, and backpressure: Methods.Cleaning v1.0, Chapters 5, 6, 10, 11.
VIII. Risk Control & Rollback
- Graded responses:
- Minor (warn): slight artifact_score excess with stable SLI.img.* → continue publishing with q_score down-weighted.
- Moderate (rollback): DeltaE_00.P99 or err_geo out-of-bounds → rollback to the last stable manifest.
- Critical (isolate): delta_form > tol_Tarr or missing manifest_signed → quarantine the batch and halt publication.
- Audit: log all violations to audit_report with TraceID, archive in the manifest.
Summary
This appendix supplies an instantiable contract library C20-* and policy-card templates that cover key quality points and runtime SLOs across the imaging chain. Combined with I20-* and the publication/audit interfaces of Methods.Cleaning v1.0, it enables a declarable, revertible, and traceable imaging-release loop.