@photivra/engine 0.6.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +674 -0
- package/CHANGELOG.md +191 -0
- package/CITATION.cff +1 -1
- package/CONTRIBUTING.md +76 -0
- package/DCO +33 -0
- package/NODE_SUPPORT.md +37 -0
- package/NOTICE +2 -0
- package/README.md +139 -72
- package/SECURITY.md +55 -0
- package/THIRD_PARTY.md +63 -0
- package/dist/camera/equivalent-focal-length.d.ts +9 -0
- package/dist/camera/equivalent-focal-length.d.ts.map +1 -1
- package/dist/camera/equivalent-focal-length.js +9 -0
- package/dist/camera/equivalent-focal-length.js.map +1 -1
- package/dist/camera/field-of-view.d.ts +13 -0
- package/dist/camera/field-of-view.d.ts.map +1 -1
- package/dist/camera/field-of-view.js +13 -0
- package/dist/camera/field-of-view.js.map +1 -1
- package/dist/camera/projected-object-size.d.ts +8 -0
- package/dist/camera/projected-object-size.d.ts.map +1 -1
- package/dist/camera/projected-object-size.js +8 -0
- package/dist/camera/projected-object-size.js.map +1 -1
- package/dist/capture/capture-export-metadata.d.ts +60 -0
- package/dist/capture/capture-export-metadata.d.ts.map +1 -0
- package/dist/capture/capture-export-metadata.js +62 -0
- package/dist/capture/capture-export-metadata.js.map +1 -0
- package/dist/capture/environment-raw-producer.d.ts +55 -0
- package/dist/capture/environment-raw-producer.d.ts.map +1 -0
- package/dist/capture/environment-raw-producer.js +88 -0
- package/dist/capture/environment-raw-producer.js.map +1 -0
- package/dist/capture/export-jpeg.d.ts +12 -0
- package/dist/capture/export-jpeg.d.ts.map +1 -0
- package/dist/capture/export-jpeg.js +126 -0
- package/dist/capture/export-jpeg.js.map +1 -0
- package/dist/capture/export-tiff.d.ts +45 -0
- package/dist/capture/export-tiff.d.ts.map +1 -0
- package/dist/capture/export-tiff.js +129 -0
- package/dist/capture/export-tiff.js.map +1 -0
- package/dist/capture/focus-control.d.ts +210 -0
- package/dist/capture/focus-control.d.ts.map +1 -0
- package/dist/capture/focus-control.js +664 -0
- package/dist/capture/focus-control.js.map +1 -0
- package/dist/capture/linear-encoding.d.ts +59 -0
- package/dist/capture/linear-encoding.d.ts.map +1 -0
- package/dist/capture/linear-encoding.js +98 -0
- package/dist/capture/linear-encoding.js.map +1 -0
- package/dist/capture/photographic-export.d.ts +135 -0
- package/dist/capture/photographic-export.d.ts.map +1 -0
- package/dist/capture/photographic-export.js +273 -0
- package/dist/capture/photographic-export.js.map +1 -0
- package/dist/capture/raw-frame-limits.d.ts +12 -0
- package/dist/capture/raw-frame-limits.d.ts.map +1 -0
- package/dist/capture/raw-frame-limits.js +13 -0
- package/dist/capture/raw-frame-limits.js.map +1 -0
- package/dist/capture/raw-frame-reconstruction.d.ts +48 -0
- package/dist/capture/raw-frame-reconstruction.d.ts.map +1 -0
- package/dist/capture/raw-frame-reconstruction.js +146 -0
- package/dist/capture/raw-frame-reconstruction.js.map +1 -0
- package/dist/capture/release-sequence.d.ts +120 -0
- package/dist/capture/release-sequence.d.ts.map +1 -0
- package/dist/capture/release-sequence.js +446 -0
- package/dist/capture/release-sequence.js.map +1 -0
- package/dist/capture/sensor-raw-frame.d.ts +34 -0
- package/dist/capture/sensor-raw-frame.d.ts.map +1 -0
- package/dist/capture/sensor-raw-frame.js +106 -0
- package/dist/capture/sensor-raw-frame.js.map +1 -0
- package/dist/capture/sensor-raw-producer.d.ts +51 -0
- package/dist/capture/sensor-raw-producer.d.ts.map +1 -0
- package/dist/capture/sensor-raw-producer.js +235 -0
- package/dist/capture/sensor-raw-producer.js.map +1 -0
- package/dist/capture/simulated-capture.d.ts +125 -0
- package/dist/capture/simulated-capture.d.ts.map +1 -0
- package/dist/capture/simulated-capture.js +248 -0
- package/dist/capture/simulated-capture.js.map +1 -0
- package/dist/color/capture-color.d.ts +73 -0
- package/dist/color/capture-color.d.ts.map +1 -0
- package/dist/color/capture-color.js +145 -0
- package/dist/color/capture-color.js.map +1 -0
- package/dist/color/sensor-color-development.d.ts +23 -0
- package/dist/color/sensor-color-development.d.ts.map +1 -0
- package/dist/color/sensor-color-development.js +56 -0
- package/dist/color/sensor-color-development.js.map +1 -0
- package/dist/color/white-balance.d.ts +175 -0
- package/dist/color/white-balance.d.ts.map +1 -0
- package/dist/color/white-balance.js +606 -0
- package/dist/color/white-balance.js.map +1 -0
- package/dist/composition/image-formation-plan.d.ts +481 -0
- package/dist/composition/image-formation-plan.d.ts.map +1 -0
- package/dist/composition/image-formation-plan.js +2499 -0
- package/dist/composition/image-formation-plan.js.map +1 -0
- package/dist/composition/plan-consumer.d.ts +53 -0
- package/dist/composition/plan-consumer.d.ts.map +1 -0
- package/dist/composition/plan-consumer.js +119 -0
- package/dist/composition/plan-consumer.js.map +1 -0
- package/dist/core/calculation-result.d.ts.map +1 -1
- package/dist/core/calculation-result.js +6 -0
- package/dist/core/calculation-result.js.map +1 -1
- package/dist/core/canonical-json.d.ts +18 -0
- package/dist/core/canonical-json.d.ts.map +1 -0
- package/dist/core/canonical-json.js +44 -0
- package/dist/core/canonical-json.js.map +1 -0
- package/dist/core/configuration-error.d.ts +6 -0
- package/dist/core/configuration-error.d.ts.map +1 -1
- package/dist/core/configuration-error.js +6 -0
- package/dist/core/configuration-error.js.map +1 -1
- package/dist/core/evidence-provenance.d.ts +6 -0
- package/dist/core/evidence-provenance.d.ts.map +1 -1
- package/dist/core/evidence-provenance.js +7 -0
- package/dist/core/evidence-provenance.js.map +1 -1
- package/dist/core/image-formation.d.ts +9 -3
- package/dist/core/image-formation.d.ts.map +1 -1
- package/dist/core/image-formation.js +29 -5
- package/dist/core/image-formation.js.map +1 -1
- package/dist/core/owned-data.d.ts +25 -0
- package/dist/core/owned-data.d.ts.map +1 -0
- package/dist/core/owned-data.js +34 -0
- package/dist/core/owned-data.js.map +1 -0
- package/dist/core/record-validation.d.ts +17 -0
- package/dist/core/record-validation.d.ts.map +1 -0
- package/dist/core/record-validation.js +44 -0
- package/dist/core/record-validation.js.map +1 -0
- package/dist/core/scientific-assurance.d.ts +101 -0
- package/dist/core/scientific-assurance.d.ts.map +1 -0
- package/dist/core/scientific-assurance.js +301 -0
- package/dist/core/scientific-assurance.js.map +1 -0
- package/dist/core/spectral-composition.d.ts +106 -0
- package/dist/core/spectral-composition.d.ts.map +1 -0
- package/dist/core/spectral-composition.js +334 -0
- package/dist/core/spectral-composition.js.map +1 -0
- package/dist/core/spectral.d.ts +34 -0
- package/dist/core/spectral.d.ts.map +1 -0
- package/dist/core/spectral.js +57 -0
- package/dist/core/spectral.js.map +1 -0
- package/dist/core/validation.d.ts +6 -0
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +6 -0
- package/dist/core/validation.js.map +1 -1
- package/dist/core/version.d.ts +9 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +10 -0
- package/dist/core/version.js.map +1 -0
- package/dist/equipment/exposure-capabilities.d.ts +125 -0
- package/dist/equipment/exposure-capabilities.d.ts.map +1 -0
- package/dist/equipment/exposure-capabilities.js +391 -0
- package/dist/equipment/exposure-capabilities.js.map +1 -0
- package/dist/equipment/generic-tier-assets.d.ts +82 -0
- package/dist/equipment/generic-tier-assets.d.ts.map +1 -0
- package/dist/equipment/generic-tier-assets.js +119 -0
- package/dist/equipment/generic-tier-assets.js.map +1 -0
- package/dist/equipment/generic-tier-presets.d.ts +57 -0
- package/dist/equipment/generic-tier-presets.d.ts.map +1 -0
- package/dist/equipment/generic-tier-presets.js +122 -0
- package/dist/equipment/generic-tier-presets.js.map +1 -0
- package/dist/equipment/iso-capabilities.d.ts +143 -0
- package/dist/equipment/iso-capabilities.d.ts.map +1 -0
- package/dist/equipment/iso-capabilities.js +578 -0
- package/dist/equipment/iso-capabilities.js.map +1 -0
- package/dist/equipment/metering-capabilities.d.ts +58 -0
- package/dist/equipment/metering-capabilities.d.ts.map +1 -0
- package/dist/equipment/metering-capabilities.js +151 -0
- package/dist/equipment/metering-capabilities.js.map +1 -0
- package/dist/equipment/release-capabilities.d.ts +33 -0
- package/dist/equipment/release-capabilities.d.ts.map +1 -0
- package/dist/equipment/release-capabilities.js +176 -0
- package/dist/equipment/release-capabilities.js.map +1 -0
- package/dist/exposure/exposure-duration-control.d.ts +72 -0
- package/dist/exposure/exposure-duration-control.d.ts.map +1 -0
- package/dist/exposure/exposure-duration-control.js +161 -0
- package/dist/exposure/exposure-duration-control.js.map +1 -0
- package/dist/exposure/exposure-mode-resolver.d.ts +637 -0
- package/dist/exposure/exposure-mode-resolver.d.ts.map +1 -0
- package/dist/exposure/exposure-mode-resolver.js +1905 -0
- package/dist/exposure/exposure-mode-resolver.js.map +1 -0
- package/dist/exposure/exposure.d.ts +8 -0
- package/dist/exposure/exposure.d.ts.map +1 -1
- package/dist/exposure/exposure.js +8 -0
- package/dist/exposure/exposure.js.map +1 -1
- package/dist/exposure/flash.d.ts +179 -0
- package/dist/exposure/flash.d.ts.map +1 -0
- package/dist/exposure/flash.js +644 -0
- package/dist/exposure/flash.js.map +1 -0
- package/dist/exposure/metering-scene-radiance.d.ts +72 -0
- package/dist/exposure/metering-scene-radiance.d.ts.map +1 -0
- package/dist/exposure/metering-scene-radiance.js +222 -0
- package/dist/exposure/metering-scene-radiance.js.map +1 -0
- package/dist/exposure/metering-target.d.ts +67 -0
- package/dist/exposure/metering-target.d.ts.map +1 -0
- package/dist/exposure/metering-target.js +265 -0
- package/dist/exposure/metering-target.js.map +1 -0
- package/dist/exposure/metering-temporal.d.ts +76 -0
- package/dist/exposure/metering-temporal.d.ts.map +1 -0
- package/dist/exposure/metering-temporal.js +210 -0
- package/dist/exposure/metering-temporal.js.map +1 -0
- package/dist/exposure/metering.d.ts +124 -0
- package/dist/exposure/metering.d.ts.map +1 -0
- package/dist/exposure/metering.js +422 -0
- package/dist/exposure/metering.js.map +1 -0
- package/dist/exposure/program-line.d.ts +29 -0
- package/dist/exposure/program-line.d.ts.map +1 -0
- package/dist/exposure/program-line.js +126 -0
- package/dist/exposure/program-line.js.map +1 -0
- package/dist/index.d.ts +87 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +85 -6
- package/dist/index.js.map +1 -1
- package/dist/motion/camera-rotation.d.ts +16 -0
- package/dist/motion/camera-rotation.d.ts.map +1 -1
- package/dist/motion/camera-rotation.js +16 -0
- package/dist/motion/camera-rotation.js.map +1 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts +13 -0
- package/dist/motion/capture-rotation-inverse-mapping.d.ts.map +1 -1
- package/dist/motion/capture-rotation-inverse-mapping.js +13 -0
- package/dist/motion/capture-rotation-inverse-mapping.js.map +1 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts +15 -0
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts.map +1 -1
- package/dist/motion/capture-rotation-temporal-quadrature.js +15 -0
- package/dist/motion/capture-rotation-temporal-quadrature.js.map +1 -1
- package/dist/motion/capture-rotation-trajectory.d.ts +15 -0
- package/dist/motion/capture-rotation-trajectory.d.ts.map +1 -1
- package/dist/motion/capture-rotation-trajectory.js +15 -0
- package/dist/motion/capture-rotation-trajectory.js.map +1 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts +119 -0
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts.map +1 -0
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js +263 -0
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js.map +1 -0
- package/dist/motion/extended-object-projection.d.ts +175 -0
- package/dist/motion/extended-object-projection.d.ts.map +1 -0
- package/dist/motion/extended-object-projection.js +402 -0
- package/dist/motion/extended-object-projection.js.map +1 -0
- package/dist/motion/projected-motion.d.ts +11 -0
- package/dist/motion/projected-motion.d.ts.map +1 -1
- package/dist/motion/projected-motion.js +11 -0
- package/dist/motion/projected-motion.js.map +1 -1
- package/dist/optics/aperture.d.ts +9 -0
- package/dist/optics/aperture.d.ts.map +1 -1
- package/dist/optics/aperture.js +9 -0
- package/dist/optics/aperture.js.map +1 -1
- package/dist/optics/circle-of-confusion.d.ts +8 -0
- package/dist/optics/circle-of-confusion.d.ts.map +1 -1
- package/dist/optics/circle-of-confusion.js +8 -0
- package/dist/optics/circle-of-confusion.js.map +1 -1
- package/dist/optics/complex-pupil-psf.d.ts +128 -0
- package/dist/optics/complex-pupil-psf.d.ts.map +1 -0
- package/dist/optics/complex-pupil-psf.js +462 -0
- package/dist/optics/complex-pupil-psf.js.map +1 -0
- package/dist/optics/depth-of-field.d.ts +18 -0
- package/dist/optics/depth-of-field.d.ts.map +1 -1
- package/dist/optics/depth-of-field.js +29 -4
- package/dist/optics/depth-of-field.js.map +1 -1
- package/dist/optics/diffraction.d.ts +8 -0
- package/dist/optics/diffraction.d.ts.map +1 -1
- package/dist/optics/diffraction.js +8 -0
- package/dist/optics/diffraction.js.map +1 -1
- package/dist/optics/focus-breathing.d.ts +13 -0
- package/dist/optics/focus-breathing.d.ts.map +1 -1
- package/dist/optics/focus-breathing.js +13 -0
- package/dist/optics/focus-breathing.js.map +1 -1
- package/dist/optics/focus-state.d.ts +47 -0
- package/dist/optics/focus-state.d.ts.map +1 -0
- package/dist/optics/focus-state.js +78 -0
- package/dist/optics/focus-state.js.map +1 -0
- package/dist/optics/front-of-lens-filter.d.ts +114 -0
- package/dist/optics/front-of-lens-filter.d.ts.map +1 -0
- package/dist/optics/front-of-lens-filter.js +468 -0
- package/dist/optics/front-of-lens-filter.js.map +1 -0
- package/dist/optics/illumination-vignetting.d.ts +9 -0
- package/dist/optics/illumination-vignetting.d.ts.map +1 -1
- package/dist/optics/illumination-vignetting.js +9 -0
- package/dist/optics/illumination-vignetting.js.map +1 -1
- package/dist/optics/lateral-chromatic-aberration.d.ts +11 -0
- package/dist/optics/lateral-chromatic-aberration.d.ts.map +1 -1
- package/dist/optics/lateral-chromatic-aberration.js +11 -0
- package/dist/optics/lateral-chromatic-aberration.js.map +1 -1
- package/dist/optics/lens-psf-profile.d.ts +217 -0
- package/dist/optics/lens-psf-profile.d.ts.map +1 -0
- package/dist/optics/lens-psf-profile.js +823 -0
- package/dist/optics/lens-psf-profile.js.map +1 -0
- package/dist/optics/polygon-diffraction.d.ts +67 -0
- package/dist/optics/polygon-diffraction.d.ts.map +1 -0
- package/dist/optics/polygon-diffraction.js +145 -0
- package/dist/optics/polygon-diffraction.js.map +1 -0
- package/dist/optics/profile-contract.d.ts +42 -0
- package/dist/optics/profile-contract.d.ts.map +1 -0
- package/dist/optics/profile-contract.js +92 -0
- package/dist/optics/profile-contract.js.map +1 -0
- package/dist/optics/psf-foundation.d.ts +16 -3
- package/dist/optics/psf-foundation.d.ts.map +1 -1
- package/dist/optics/psf-foundation.js +28 -15
- package/dist/optics/psf-foundation.js.map +1 -1
- package/dist/optics/radial-distortion.d.ts +18 -0
- package/dist/optics/radial-distortion.d.ts.map +1 -1
- package/dist/optics/radial-distortion.js +18 -0
- package/dist/optics/radial-distortion.js.map +1 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts +213 -0
- package/dist/optics/scene-to-sensor-irradiance.d.ts.map +1 -0
- package/dist/optics/scene-to-sensor-irradiance.js +662 -0
- package/dist/optics/scene-to-sensor-irradiance.js.map +1 -0
- package/dist/optics/scene-to-sensor-quadrature.d.ts +63 -0
- package/dist/optics/scene-to-sensor-quadrature.d.ts.map +1 -0
- package/dist/optics/scene-to-sensor-quadrature.js +82 -0
- package/dist/optics/scene-to-sensor-quadrature.js.map +1 -0
- package/dist/optics/sensor-environment-query.d.ts +60 -0
- package/dist/optics/sensor-environment-query.d.ts.map +1 -0
- package/dist/optics/sensor-environment-query.js +50 -0
- package/dist/optics/sensor-environment-query.js.map +1 -0
- package/dist/optics/sensor-psf-quadrature.d.ts +70 -0
- package/dist/optics/sensor-psf-quadrature.d.ts.map +1 -0
- package/dist/optics/sensor-psf-quadrature.js +101 -0
- package/dist/optics/sensor-psf-quadrature.js.map +1 -0
- package/dist/optics/sensor-psf-support.d.ts +20 -0
- package/dist/optics/sensor-psf-support.d.ts.map +1 -0
- package/dist/optics/sensor-psf-support.js +13 -0
- package/dist/optics/sensor-psf-support.js.map +1 -0
- package/dist/optics/stray-light.d.ts +91 -0
- package/dist/optics/stray-light.d.ts.map +1 -0
- package/dist/optics/stray-light.js +110 -0
- package/dist/optics/stray-light.js.map +1 -0
- package/dist/optics/thin-lens.d.ts +8 -0
- package/dist/optics/thin-lens.d.ts.map +1 -1
- package/dist/optics/thin-lens.js +8 -0
- package/dist/optics/thin-lens.js.map +1 -1
- package/dist/output/capture-corrected-sdr.d.ts +49 -0
- package/dist/output/capture-corrected-sdr.d.ts.map +1 -0
- package/dist/output/capture-corrected-sdr.js +149 -0
- package/dist/output/capture-corrected-sdr.js.map +1 -0
- package/dist/output/capture-geometry.d.ts.map +1 -1
- package/dist/output/capture-geometry.js +8 -0
- package/dist/output/capture-geometry.js.map +1 -1
- package/dist/output/capture-sdr.d.ts +49 -0
- package/dist/output/capture-sdr.d.ts.map +1 -0
- package/dist/output/capture-sdr.js +90 -0
- package/dist/output/capture-sdr.js.map +1 -0
- package/dist/output/crop.d.ts +6 -0
- package/dist/output/crop.d.ts.map +1 -1
- package/dist/output/crop.js +6 -0
- package/dist/output/crop.js.map +1 -1
- package/dist/output/geometric-transforms.d.ts +137 -0
- package/dist/output/geometric-transforms.d.ts.map +1 -0
- package/dist/output/geometric-transforms.js +225 -0
- package/dist/output/geometric-transforms.js.map +1 -0
- package/dist/output/lens-corrections.d.ts +121 -0
- package/dist/output/lens-corrections.d.ts.map +1 -0
- package/dist/output/lens-corrections.js +210 -0
- package/dist/output/lens-corrections.js.map +1 -0
- package/dist/output/sdr-rendering.d.ts +81 -0
- package/dist/output/sdr-rendering.d.ts.map +1 -0
- package/dist/output/sdr-rendering.js +106 -0
- package/dist/output/sdr-rendering.js.map +1 -0
- package/dist/output/subject-framing-crop.d.ts +8 -0
- package/dist/output/subject-framing-crop.d.ts.map +1 -1
- package/dist/output/subject-framing-crop.js +8 -0
- package/dist/output/subject-framing-crop.js.map +1 -1
- package/dist/schema/camera.d.ts +6 -0
- package/dist/schema/camera.d.ts.map +1 -1
- package/dist/schema/illumination-spectral.d.ts +51 -0
- package/dist/schema/illumination-spectral.d.ts.map +1 -0
- package/dist/schema/illumination-spectral.js +132 -0
- package/dist/schema/illumination-spectral.js.map +1 -0
- package/dist/schema/illumination-temporal.d.ts +156 -0
- package/dist/schema/illumination-temporal.d.ts.map +1 -0
- package/dist/schema/illumination-temporal.js +554 -0
- package/dist/schema/illumination-temporal.js.map +1 -0
- package/dist/schema/illumination.d.ts +138 -0
- package/dist/schema/illumination.d.ts.map +1 -0
- package/dist/schema/illumination.js +483 -0
- package/dist/schema/illumination.js.map +1 -0
- package/dist/schema/scene-radiance-temporal.d.ts +107 -0
- package/dist/schema/scene-radiance-temporal.d.ts.map +1 -0
- package/dist/schema/scene-radiance-temporal.js +259 -0
- package/dist/schema/scene-radiance-temporal.js.map +1 -0
- package/dist/schema/scene-radiance.d.ts +185 -0
- package/dist/schema/scene-radiance.d.ts.map +1 -0
- package/dist/schema/scene-radiance.js +535 -0
- package/dist/schema/scene-radiance.js.map +1 -0
- package/dist/schema/scene.d.ts +7 -0
- package/dist/schema/scene.d.ts.map +1 -1
- package/dist/schema/validation.d.ts.map +1 -1
- package/dist/schema/validation.js +7 -0
- package/dist/schema/validation.js.map +1 -1
- package/dist/sensor/accumulated-charge.d.ts +199 -0
- package/dist/sensor/accumulated-charge.d.ts.map +1 -0
- package/dist/sensor/accumulated-charge.js +450 -0
- package/dist/sensor/accumulated-charge.js.map +1 -0
- package/dist/sensor/architecture.d.ts +48 -13
- package/dist/sensor/architecture.d.ts.map +1 -1
- package/dist/sensor/architecture.js +58 -16
- package/dist/sensor/architecture.js.map +1 -1
- package/dist/sensor/camera-saturation-capacity.d.ts +138 -0
- package/dist/sensor/camera-saturation-capacity.d.ts.map +1 -0
- package/dist/sensor/camera-saturation-capacity.js +356 -0
- package/dist/sensor/camera-saturation-capacity.js.map +1 -0
- package/dist/sensor/capture-color-sampling-binding.d.ts +1 -0
- package/dist/sensor/capture-color-sampling-binding.d.ts.map +1 -1
- package/dist/sensor/capture-color-sampling-binding.js +14 -0
- package/dist/sensor/capture-color-sampling-binding.js.map +1 -1
- package/dist/sensor/capture-mode-timing.d.ts +63 -0
- package/dist/sensor/capture-mode-timing.d.ts.map +1 -0
- package/dist/sensor/capture-mode-timing.js +270 -0
- package/dist/sensor/capture-mode-timing.js.map +1 -0
- package/dist/sensor/capture-mode.d.ts.map +1 -1
- package/dist/sensor/capture-mode.js +13 -0
- package/dist/sensor/capture-mode.js.map +1 -1
- package/dist/sensor/color-sampling.d.ts.map +1 -1
- package/dist/sensor/color-sampling.js +19 -0
- package/dist/sensor/color-sampling.js.map +1 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts +126 -0
- package/dist/sensor/constant-rate-temporal-integration.d.ts.map +1 -0
- package/dist/sensor/constant-rate-temporal-integration.js +382 -0
- package/dist/sensor/constant-rate-temporal-integration.js.map +1 -0
- package/dist/sensor/dark-current.d.ts +169 -0
- package/dist/sensor/dark-current.d.ts.map +1 -0
- package/dist/sensor/dark-current.js +427 -0
- package/dist/sensor/dark-current.js.map +1 -0
- package/dist/sensor/environment-photo-signal.d.ts +123 -0
- package/dist/sensor/environment-photo-signal.d.ts.map +1 -0
- package/dist/sensor/environment-photo-signal.js +186 -0
- package/dist/sensor/environment-photo-signal.js.map +1 -0
- package/dist/sensor/eqe-electron-rate.d.ts +107 -0
- package/dist/sensor/eqe-electron-rate.d.ts.map +1 -0
- package/dist/sensor/eqe-electron-rate.js +561 -0
- package/dist/sensor/eqe-electron-rate.js.map +1 -0
- package/dist/sensor/eqe-local-exposure.d.ts +65 -0
- package/dist/sensor/eqe-local-exposure.d.ts.map +1 -0
- package/dist/sensor/eqe-local-exposure.js +84 -0
- package/dist/sensor/eqe-local-exposure.js.map +1 -0
- package/dist/sensor/eqe-temporal-exposure.d.ts +55 -0
- package/dist/sensor/eqe-temporal-exposure.d.ts.map +1 -0
- package/dist/sensor/eqe-temporal-exposure.js +62 -0
- package/dist/sensor/eqe-temporal-exposure.js.map +1 -0
- package/dist/sensor/exposure-window.d.ts +14 -0
- package/dist/sensor/exposure-window.d.ts.map +1 -1
- package/dist/sensor/exposure-window.js +14 -0
- package/dist/sensor/exposure-window.js.map +1 -1
- package/dist/sensor/iso-signal-chain.d.ts +148 -0
- package/dist/sensor/iso-signal-chain.d.ts.map +1 -0
- package/dist/sensor/iso-signal-chain.js +411 -0
- package/dist/sensor/iso-signal-chain.js.map +1 -0
- package/dist/sensor/local-exposure-binding.d.ts +87 -0
- package/dist/sensor/local-exposure-binding.d.ts.map +1 -0
- package/dist/sensor/local-exposure-binding.js +214 -0
- package/dist/sensor/local-exposure-binding.js.map +1 -0
- package/dist/sensor/optical-stack.d.ts.map +1 -1
- package/dist/sensor/optical-stack.js +17 -0
- package/dist/sensor/optical-stack.js.map +1 -1
- package/dist/sensor/photon-energy.d.ts +97 -0
- package/dist/sensor/photon-energy.d.ts.map +1 -0
- package/dist/sensor/photon-energy.js +390 -0
- package/dist/sensor/photon-energy.js.map +1 -0
- package/dist/sensor/physical-charge-capacity.d.ts +130 -0
- package/dist/sensor/physical-charge-capacity.d.ts.map +1 -0
- package/dist/sensor/physical-charge-capacity.js +345 -0
- package/dist/sensor/physical-charge-capacity.js.map +1 -0
- package/dist/sensor/pixel-pitch.d.ts +6 -0
- package/dist/sensor/pixel-pitch.d.ts.map +1 -1
- package/dist/sensor/pixel-pitch.js +6 -0
- package/dist/sensor/pixel-pitch.js.map +1 -1
- package/dist/sensor/radiometry-readiness.d.ts +10 -0
- package/dist/sensor/radiometry-readiness.d.ts.map +1 -1
- package/dist/sensor/radiometry-readiness.js +10 -0
- package/dist/sensor/radiometry-readiness.js.map +1 -1
- package/dist/sensor/raw-readout.d.ts +314 -0
- package/dist/sensor/raw-readout.d.ts.map +1 -0
- package/dist/sensor/raw-readout.js +914 -0
- package/dist/sensor/raw-readout.js.map +1 -0
- package/dist/sensor/raw-reconstruction.d.ts +170 -0
- package/dist/sensor/raw-reconstruction.d.ts.map +1 -0
- package/dist/sensor/raw-reconstruction.js +424 -0
- package/dist/sensor/raw-reconstruction.js.map +1 -0
- package/dist/sensor/readout-exposure-linkage.d.ts +12 -0
- package/dist/sensor/readout-exposure-linkage.d.ts.map +1 -1
- package/dist/sensor/readout-exposure-linkage.js +12 -0
- package/dist/sensor/readout-exposure-linkage.js.map +1 -1
- package/dist/sensor/readout-timing.d.ts +13 -0
- package/dist/sensor/readout-timing.d.ts.map +1 -1
- package/dist/sensor/readout-timing.js +13 -0
- package/dist/sensor/readout-timing.js.map +1 -1
- package/dist/sensor/response-application-compatibility.d.ts +136 -0
- package/dist/sensor/response-application-compatibility.d.ts.map +1 -0
- package/dist/sensor/response-application-compatibility.js +408 -0
- package/dist/sensor/response-application-compatibility.js.map +1 -0
- package/dist/sensor/response-operating-range.d.ts +173 -0
- package/dist/sensor/response-operating-range.d.ts.map +1 -0
- package/dist/sensor/response-operating-range.js +672 -0
- package/dist/sensor/response-operating-range.js.map +1 -0
- package/dist/sensor/responsivity-photocurrent.d.ts +158 -0
- package/dist/sensor/responsivity-photocurrent.d.ts.map +1 -0
- package/dist/sensor/responsivity-photocurrent.js +644 -0
- package/dist/sensor/responsivity-photocurrent.js.map +1 -0
- package/dist/sensor/sampling-aperture.d.ts.map +1 -1
- package/dist/sensor/sampling-aperture.js +14 -0
- package/dist/sensor/sampling-aperture.js.map +1 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts +45 -0
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts.map +1 -0
- package/dist/sensor/scene-eqe-temporal-exposure.js +64 -0
- package/dist/sensor/scene-eqe-temporal-exposure.js.map +1 -0
- package/dist/sensor/sensor-geometry.d.ts +12 -0
- package/dist/sensor/sensor-geometry.d.ts.map +1 -1
- package/dist/sensor/sensor-geometry.js +12 -0
- package/dist/sensor/sensor-geometry.js.map +1 -1
- package/dist/sensor/signal-noise.d.ts +10 -0
- package/dist/sensor/signal-noise.d.ts.map +1 -1
- package/dist/sensor/signal-noise.js +10 -0
- package/dist/sensor/signal-noise.js.map +1 -1
- package/dist/sensor/spatial-sample-reduction.d.ts +44 -1
- package/dist/sensor/spatial-sample-reduction.d.ts.map +1 -1
- package/dist/sensor/spatial-sample-reduction.js +51 -5
- package/dist/sensor/spatial-sample-reduction.js.map +1 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts +24 -0
- package/dist/sensor/spatial-sampling-quadrature.d.ts.map +1 -1
- package/dist/sensor/spatial-sampling-quadrature.js +27 -0
- package/dist/sensor/spatial-sampling-quadrature.js.map +1 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts +187 -0
- package/dist/sensor/spatio-spectral-reduction.d.ts.map +1 -0
- package/dist/sensor/spatio-spectral-reduction.js +373 -0
- package/dist/sensor/spatio-spectral-reduction.js.map +1 -0
- package/dist/sensor/spectral-coverage.d.ts +24 -0
- package/dist/sensor/spectral-coverage.d.ts.map +1 -0
- package/dist/sensor/spectral-coverage.js +86 -0
- package/dist/sensor/spectral-coverage.js.map +1 -0
- package/dist/sensor/spectral-quadrature.d.ts +169 -0
- package/dist/sensor/spectral-quadrature.d.ts.map +1 -0
- package/dist/sensor/spectral-quadrature.js +542 -0
- package/dist/sensor/spectral-quadrature.js.map +1 -0
- package/dist/sensor/spectral-response.d.ts +192 -0
- package/dist/sensor/spectral-response.d.ts.map +1 -0
- package/dist/sensor/spectral-response.js +664 -0
- package/dist/sensor/spectral-response.js.map +1 -0
- package/dist/sensor/temporal-eqe-sum.d.ts +15 -0
- package/dist/sensor/temporal-eqe-sum.d.ts.map +1 -0
- package/dist/sensor/temporal-eqe-sum.js +30 -0
- package/dist/sensor/temporal-eqe-sum.js.map +1 -0
- package/dist/sensor/temporal-photo-signal.d.ts +38 -0
- package/dist/sensor/temporal-photo-signal.d.ts.map +1 -0
- package/dist/sensor/temporal-photo-signal.js +110 -0
- package/dist/sensor/temporal-photo-signal.js.map +1 -0
- package/dist/sensor/temporal-sample-binding.d.ts +6 -0
- package/dist/sensor/temporal-sample-binding.d.ts.map +1 -0
- package/dist/sensor/temporal-sample-binding.js +32 -0
- package/dist/sensor/temporal-sample-binding.js.map +1 -0
- package/dist/simulation/poc-simulation.d.ts.map +1 -1
- package/dist/simulation/poc-simulation.js +34 -11
- package/dist/simulation/poc-simulation.js.map +1 -1
- package/dist/stabilization/camera-shake.d.ts +11 -0
- package/dist/stabilization/camera-shake.d.ts.map +1 -1
- package/dist/stabilization/camera-shake.js +11 -0
- package/dist/stabilization/camera-shake.js.map +1 -1
- package/dist/stabilization/system.d.ts +218 -0
- package/dist/stabilization/system.d.ts.map +1 -0
- package/dist/stabilization/system.js +695 -0
- package/dist/stabilization/system.js.map +1 -0
- package/docs/API_REFERENCE.md +2017 -0
- package/docs/API_STYLE.md +139 -3
- package/docs/ARCHITECTURE.md +134 -24
- package/docs/AUTOMATION_COORDINATION.md +2 -0
- package/docs/CAPTURE_COLOR.md +25 -0
- package/docs/CAPTURE_CORRECTED_SDR.md +25 -0
- package/docs/CAPTURE_EXPORT_METADATA.md +27 -0
- package/docs/CAPTURE_SDR.md +20 -0
- package/docs/DEVELOPERS.md +60 -0
- package/docs/DIGITAL_OPTICS_FOUNDATION.md +69 -0
- package/docs/ENVIRONMENT_RAW_CAPTURE.md +187 -0
- package/docs/EXPORT_ACCEPTANCE.md +133 -0
- package/docs/GENERIC_TIER_PRESETS.md +269 -0
- package/docs/GEOMETRIC_PREPARATION_REUSE.md +141 -0
- package/docs/IMAGE_FORMATION.md +80 -10
- package/docs/LINEAR_CAPTURE_ENCODING.md +25 -0
- package/docs/MOTION_AND_SIGNAL.md +5 -3
- package/docs/NUMERICAL_CORRECTNESS.md +191 -0
- package/docs/PERFORMANCE_BASELINE.md +56 -0
- package/docs/PHOTOGRAPHIC_EXPORT.md +206 -0
- package/docs/PHYSICS_FOUNDATION.md +152 -5
- package/docs/POC_API.md +2 -0
- package/docs/POC_PROJECTION_REUSE.md +124 -0
- package/docs/PROCESSED_OUTPUT.md +157 -0
- package/docs/PRODUCTION_COMPOSITION.md +373 -0
- package/docs/PRODUCTION_ENVIRONMENT_CAPTURE.md +131 -0
- package/docs/PROVENANCE.md +4 -0
- package/docs/PSF_FOUNDATION.md +110 -88
- package/docs/RAW_FRAME_ENVELOPE.md +56 -0
- package/docs/RAW_FRAME_RECONSTRUCTION.md +30 -0
- package/docs/RELEASE_1_0.md +66 -0
- package/docs/RELEASE_1_0_1.md +61 -0
- package/docs/RELEASE_AUDIT.md +39 -0
- package/docs/SCENE_RADIANCE_AND_ILLUMINATION.md +298 -0
- package/docs/SCENE_SENSOR_QUADRATURE.md +98 -0
- package/docs/SCENE_SENSOR_TEMPORAL_EXPOSURE.md +86 -0
- package/docs/SCIENTIFIC_ASSURANCE.md +280 -0
- package/docs/SCIENTIFIC_CONFORMANCE.md +83 -0
- package/docs/SDR_RENDERING.md +33 -0
- package/docs/SENSOR_ENVIRONMENT_QUERY.md +86 -0
- package/docs/SENSOR_EQE_LOCAL_EXPOSURE.md +104 -0
- package/docs/SENSOR_EQE_TEMPORAL_EXPOSURE.md +74 -0
- package/docs/SENSOR_PSF_QUADRATURE.md +90 -0
- package/docs/SENSOR_RAW_FRAME.md +20 -0
- package/docs/SENSOR_RAW_PRODUCER.md +77 -0
- package/docs/SIGNAL_CONFORMANCE.md +23 -0
- package/docs/SIMULATED_CAPTURE.md +65 -0
- package/docs/STABILIZATION.md +160 -17
- package/docs/TEMPORAL_PHOTO_RAW.md +83 -0
- package/docs/TIER_ACCEPTANCE.md +129 -0
- package/docs/TIER_PRESET_ACCEPTANCE.md +59 -0
- package/docs/USAGE.md +5050 -1047
- package/docs/V1_COMPOSITION_MAP.md +123 -0
- package/docs/V1_HELPER_REUSE_REVIEW.md +60 -0
- package/docs/V1_PERFORMANCE_DISPOSITION.md +88 -0
- package/docs/api/camera-equivalent-focal-length.md +53 -0
- package/docs/api/camera-field-of-view.md +119 -0
- package/docs/api/camera-projected-object-size.md +54 -0
- package/docs/api/capture-capture-export-metadata.md +107 -0
- package/docs/api/capture-environment-raw-producer.md +56 -0
- package/docs/api/capture-focus-control.md +419 -0
- package/docs/api/capture-linear-encoding.md +99 -0
- package/docs/api/capture-photographic-export.md +172 -0
- package/docs/api/capture-raw-frame-reconstruction.md +87 -0
- package/docs/api/capture-release-sequence.md +252 -0
- package/docs/api/capture-sensor-raw-frame.md +66 -0
- package/docs/api/capture-sensor-raw-producer.md +98 -0
- package/docs/api/capture-simulated-capture.md +179 -0
- package/docs/api/color-capture-color.md +122 -0
- package/docs/api/color-white-balance.md +386 -0
- package/docs/api/composition-image-formation-plan.md +825 -0
- package/docs/api/composition-plan-consumer.md +98 -0
- package/docs/api/core-calculation-result.md +220 -0
- package/docs/api/core-configuration-error.md +19 -0
- package/docs/api/core-image-formation.md +204 -0
- package/docs/api/core-scientific-assurance.md +214 -0
- package/docs/api/core-spectral-composition.md +268 -0
- package/docs/api/core-spectral.md +78 -0
- package/docs/api/core-validation.md +34 -0
- package/docs/api/core-version.md +14 -0
- package/docs/api/equipment-exposure-capabilities.md +270 -0
- package/docs/api/equipment-generic-tier-assets.md +82 -0
- package/docs/api/equipment-generic-tier-presets.md +103 -0
- package/docs/api/equipment-iso-capabilities.md +295 -0
- package/docs/api/equipment-metering-capabilities.md +126 -0
- package/docs/api/equipment-release-capabilities.md +91 -0
- package/docs/api/exports.json +5656 -0
- package/docs/api/exposure-exposure-duration-control.md +115 -0
- package/docs/api/exposure-exposure-mode-resolver.md +966 -0
- package/docs/api/exposure-exposure.md +150 -0
- package/docs/api/exposure-flash.md +327 -0
- package/docs/api/exposure-metering-scene-radiance.md +154 -0
- package/docs/api/exposure-metering-target.md +134 -0
- package/docs/api/exposure-metering-temporal.md +77 -0
- package/docs/api/exposure-metering.md +172 -0
- package/docs/api/exposure-program-line.md +64 -0
- package/docs/api/motion-camera-rotation.md +215 -0
- package/docs/api/motion-capture-rotation-inverse-mapping.md +128 -0
- package/docs/api/motion-capture-rotation-temporal-quadrature.md +127 -0
- package/docs/api/motion-capture-rotation-trajectory.md +132 -0
- package/docs/api/motion-capture-translation-parallax-temporal-quadrature.md +171 -0
- package/docs/api/motion-extended-object-projection.md +312 -0
- package/docs/api/motion-projected-motion.md +60 -0
- package/docs/api/optics-aperture.md +69 -0
- package/docs/api/optics-circle-of-confusion.md +46 -0
- package/docs/api/optics-complex-pupil-psf.md +193 -0
- package/docs/api/optics-depth-of-field.md +92 -0
- package/docs/api/optics-diffraction.md +46 -0
- package/docs/api/optics-focus-breathing.md +119 -0
- package/docs/api/optics-focus-state.md +64 -0
- package/docs/api/optics-front-of-lens-filter.md +263 -0
- package/docs/api/optics-illumination-vignetting.md +95 -0
- package/docs/api/optics-lateral-chromatic-aberration.md +225 -0
- package/docs/api/optics-lens-psf-profile.md +380 -0
- package/docs/api/optics-polygon-diffraction.md +68 -0
- package/docs/api/optics-profile-contract.md +47 -0
- package/docs/api/optics-psf-foundation.md +181 -0
- package/docs/api/optics-radial-distortion.md +194 -0
- package/docs/api/optics-scene-to-sensor-irradiance.md +371 -0
- package/docs/api/optics-scene-to-sensor-quadrature.md +78 -0
- package/docs/api/optics-sensor-environment-query.md +58 -0
- package/docs/api/optics-sensor-psf-quadrature.md +81 -0
- package/docs/api/optics-stray-light.md +109 -0
- package/docs/api/optics-thin-lens.md +53 -0
- package/docs/api/output-capture-corrected-sdr.md +71 -0
- package/docs/api/output-capture-geometry.md +500 -0
- package/docs/api/output-capture-sdr.md +69 -0
- package/docs/api/output-crop.md +47 -0
- package/docs/api/output-geometric-transforms.md +199 -0
- package/docs/api/output-lens-corrections.md +162 -0
- package/docs/api/output-sdr-rendering.md +122 -0
- package/docs/api/output-subject-framing-crop.md +59 -0
- package/docs/api/schema-camera.md +84 -0
- package/docs/api/schema-illumination-spectral.md +77 -0
- package/docs/api/schema-illumination-temporal.md +289 -0
- package/docs/api/schema-illumination.md +246 -0
- package/docs/api/schema-scene-radiance-temporal.md +215 -0
- package/docs/api/schema-scene-radiance.md +415 -0
- package/docs/api/schema-scene.md +105 -0
- package/docs/api/schema-validation.md +25 -0
- package/docs/api/sensor-accumulated-charge.md +273 -0
- package/docs/api/sensor-architecture.md +155 -0
- package/docs/api/sensor-camera-saturation-capacity.md +215 -0
- package/docs/api/sensor-capture-color-sampling-binding.md +323 -0
- package/docs/api/sensor-capture-mode-timing.md +123 -0
- package/docs/api/sensor-capture-mode.md +321 -0
- package/docs/api/sensor-color-sampling.md +228 -0
- package/docs/api/sensor-constant-rate-temporal-integration.md +152 -0
- package/docs/api/sensor-dark-current.md +227 -0
- package/docs/api/sensor-environment-photo-signal.md +77 -0
- package/docs/api/sensor-eqe-electron-rate.md +166 -0
- package/docs/api/sensor-eqe-local-exposure.md +68 -0
- package/docs/api/sensor-eqe-temporal-exposure.md +73 -0
- package/docs/api/sensor-exposure-window.md +183 -0
- package/docs/api/sensor-iso-signal-chain.md +264 -0
- package/docs/api/sensor-local-exposure-binding.md +126 -0
- package/docs/api/sensor-optical-stack.md +211 -0
- package/docs/api/sensor-photon-energy.md +149 -0
- package/docs/api/sensor-physical-charge-capacity.md +196 -0
- package/docs/api/sensor-pixel-pitch.md +41 -0
- package/docs/api/sensor-radiometry-readiness.md +240 -0
- package/docs/api/sensor-raw-readout.md +499 -0
- package/docs/api/sensor-raw-reconstruction.md +260 -0
- package/docs/api/sensor-readout-exposure-linkage.md +172 -0
- package/docs/api/sensor-readout-timing.md +209 -0
- package/docs/api/sensor-response-application-compatibility.md +256 -0
- package/docs/api/sensor-response-operating-range.md +293 -0
- package/docs/api/sensor-responsivity-photocurrent.md +245 -0
- package/docs/api/sensor-sampling-aperture.md +221 -0
- package/docs/api/sensor-scene-eqe-temporal-exposure.md +56 -0
- package/docs/api/sensor-sensor-geometry.md +143 -0
- package/docs/api/sensor-signal-noise.md +75 -0
- package/docs/api/sensor-spatial-sample-reduction.md +186 -0
- package/docs/api/sensor-spatial-sampling-quadrature.md +188 -0
- package/docs/api/sensor-spatio-spectral-reduction.md +217 -0
- package/docs/api/sensor-spectral-coverage.md +33 -0
- package/docs/api/sensor-spectral-quadrature.md +183 -0
- package/docs/api/sensor-spectral-response.md +291 -0
- package/docs/api/sensor-temporal-photo-signal.md +62 -0
- package/docs/api/simulation-poc-simulation.md +364 -0
- package/docs/api/stabilization-camera-shake.md +71 -0
- package/docs/api/stabilization-system.md +442 -0
- package/docs/benchmarks/2026-10-01-main-baseline.json +694 -0
- package/docs/benchmarks/2026-10-02-geometric-preparation-reuse.json +2190 -0
- package/docs/benchmarks/2026-10-02-poc-projection-reuse.json +2423 -0
- package/docs/benchmarks/2026-10-02-v1-environment-gc-profile.json +210 -0
- package/docs/benchmarks/2026-10-02-v1-environment-ordinary.json +187 -0
- package/docs/benchmarks/2026-10-02-v1-geometry-gc-profile.json +756 -0
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-1.json +711 -0
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-2.json +711 -0
- package/docs/benchmarks/2026-10-02-v1-poc-gc-profile.json +885 -0
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-1.json +868 -0
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-2.json +868 -0
- package/docs/examples/production-capture.mjs +34 -0
- package/docs/examples/production-request.json +4613 -0
- package/docs/examples/quick-start.mjs +12 -0
- package/docs/validation/documentation-fragments.json +212 -0
- package/docs/validation/release-audit-inventory.json +1306 -0
- package/docs/validation/tier-acceptance-report-v1.json +2538 -0
- package/package.json +15 -3
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Module boundary and integration notes.
|
|
4
|
+
* Converts validated shooting WB into a public metadata allowlist, discarding private extras.
|
|
5
|
+
* Commits a format-neutral float master manifest; no radiance generation, clamp, WB or export
|
|
6
|
+
* encoding.
|
|
7
|
+
* @see docs/SIMULATED_CAPTURE.md for equations, coordinate/unit conventions, blockers and support
|
|
8
|
+
* limits.
|
|
9
|
+
*/
|
|
10
|
+
import { requireAllowlistedRecord, requirePublicOpaqueId } from "../core/record-validation.js";
|
|
11
|
+
import { stringifyCanonicalJson } from "../core/canonical-json.js";
|
|
12
|
+
import { freezeOwnedData } from "../core/owned-data.js";
|
|
13
|
+
import { calculatedResult } from "../core/calculation-result.js";
|
|
14
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
15
|
+
import { ENGINE_API_VERSION } from "../core/version.js";
|
|
16
|
+
import { parseResolvedWhiteBalanceState } from "../color/white-balance.js";
|
|
17
|
+
import { calculateEquivalentFocalLength35Mm } from "../camera/equivalent-focal-length.js";
|
|
18
|
+
import { parseFocusPlane } from "../optics/focus-state.js";
|
|
19
|
+
import { resolveCaptureGeometry } from "../output/capture-geometry.js";
|
|
20
|
+
export const SIMULATED_CAPTURE_SCHEMA_VERSION = "0.2.0";
|
|
21
|
+
function object(value, keys) {
|
|
22
|
+
return requireAllowlistedRecord(value, keys, "Invalid or non-allowlisted capture metadata.");
|
|
23
|
+
}
|
|
24
|
+
function enumValue(value, values) {
|
|
25
|
+
if (!values.includes(value))
|
|
26
|
+
throw new InvalidConfigurationError("Unknown capture state.");
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
function number(value, positive = false) {
|
|
30
|
+
if (typeof value !== "number" || !Number.isFinite(value) || (positive && value <= 0))
|
|
31
|
+
throw new InvalidConfigurationError("Capture number must be finite with valid sign.");
|
|
32
|
+
return Object.is(value, -0) ? 0 : value;
|
|
33
|
+
}
|
|
34
|
+
function integer(value, minimum = 1) {
|
|
35
|
+
const n = number(value);
|
|
36
|
+
if (!Number.isSafeInteger(n) || n < minimum)
|
|
37
|
+
throw new InvalidConfigurationError("Invalid capture integer.");
|
|
38
|
+
return n;
|
|
39
|
+
}
|
|
40
|
+
function array(value, maximum) {
|
|
41
|
+
if (!Array.isArray(value) || value.length > maximum ||
|
|
42
|
+
Array.from({ length: value.length }, (_, i) => i in value).includes(false))
|
|
43
|
+
throw new InvalidConfigurationError("Expected a bounded dense capture array.");
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function id(value) {
|
|
47
|
+
return requirePublicOpaqueId(value, "Expected a public opaque ID, not a path or URL.");
|
|
48
|
+
}
|
|
49
|
+
function digest(value) {
|
|
50
|
+
if (typeof value !== "string" || !/^[a-f0-9]{64}$/.test(value))
|
|
51
|
+
throw new InvalidConfigurationError("Expected a lowercase SHA-256 digest.");
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function profile(value) {
|
|
55
|
+
const r = object(value, ["id", "version"]);
|
|
56
|
+
return { id: id(r.id), version: id(r.version) };
|
|
57
|
+
}
|
|
58
|
+
function white(value) {
|
|
59
|
+
if (value === null)
|
|
60
|
+
return null;
|
|
61
|
+
const r = object(value, ["x", "y", "z"]);
|
|
62
|
+
if (r.y !== 1)
|
|
63
|
+
throw new InvalidConfigurationError("White XYZ requires Y=1.");
|
|
64
|
+
return { x: number(r.x, true), y: 1, z: number(r.z, true) };
|
|
65
|
+
}
|
|
66
|
+
function wb(value) {
|
|
67
|
+
if (value === null)
|
|
68
|
+
return null;
|
|
69
|
+
const r = object(value, ["stateId", "source", "locked", "channelGains", "sourceProfile"]);
|
|
70
|
+
const g = object(r.channelGains, ["red", "green", "blue"]);
|
|
71
|
+
if (typeof r.locked !== "boolean")
|
|
72
|
+
throw new InvalidConfigurationError("WB lock must be boolean.");
|
|
73
|
+
return { stateId: id(r.stateId), source: enumValue(r.source, ["preset", "manual-gains", "custom-measurement", "auto-white-balance"]),
|
|
74
|
+
locked: r.locked, channelGains: { red: number(g.red, true), green: number(g.green, true), blue: number(g.blue, true) },
|
|
75
|
+
sourceProfile: r.sourceProfile === null ? null : profile(r.sourceProfile) };
|
|
76
|
+
}
|
|
77
|
+
/** Converts validated shooting WB into a public metadata allowlist, discarding private extras. */
|
|
78
|
+
export function createCaptureWhiteBalanceIntent(input) {
|
|
79
|
+
const state = parseResolvedWhiteBalanceState(input.state);
|
|
80
|
+
return wb({ stateId: state.stateId, source: state.source, locked: state.locked, channelGains: state.channelGains,
|
|
81
|
+
sourceProfile: state.sourceProfile ? { id: state.sourceProfile.profileId, version: state.sourceProfile.profileVersion } : null });
|
|
82
|
+
}
|
|
83
|
+
function geometry(value) {
|
|
84
|
+
const r = object(value, ["imagingArea", "nativeRaster", "orientation", "activeCaptureRect", "outputCropRect", "outputRaster"]);
|
|
85
|
+
const area = object(r.imagingArea, ["widthMm", "heightMm"]), native = object(r.nativeRaster, ["pixelWidth", "pixelHeight"]);
|
|
86
|
+
const rect = (value) => {
|
|
87
|
+
const p = object(value, ["x", "y", "width", "height"]);
|
|
88
|
+
return { x: integer(p.x, 0), y: integer(p.y, 0), width: integer(p.width), height: integer(p.height) };
|
|
89
|
+
};
|
|
90
|
+
const output = r.outputRaster === undefined ? undefined : object(r.outputRaster, ["pixelWidth", "pixelHeight"]);
|
|
91
|
+
return { imagingArea: { widthMm: number(area.widthMm, true), heightMm: number(area.heightMm, true) },
|
|
92
|
+
nativeRaster: { pixelWidth: integer(native.pixelWidth), pixelHeight: integer(native.pixelHeight) },
|
|
93
|
+
orientation: enumValue(r.orientation, ["landscape", "portrait-clockwise", "landscape-inverted", "portrait-counter-clockwise"]),
|
|
94
|
+
...(r.activeCaptureRect === undefined ? {} : { activeCaptureRect: rect(r.activeCaptureRect) }),
|
|
95
|
+
...(r.outputCropRect === undefined ? {} : { outputCropRect: rect(r.outputCropRect) }),
|
|
96
|
+
...(output === undefined ? {} : { outputRaster: { pixelWidth: integer(output.pixelWidth), pixelHeight: integer(output.pixelHeight) } }) };
|
|
97
|
+
}
|
|
98
|
+
function plane(value, resolved, intent) {
|
|
99
|
+
const r = object(value, ["id", "imageStateId", "imageState", "rasterBinding", "pixelWidth", "pixelHeight", "channelIds", "colorProfile",
|
|
100
|
+
"encodingReferenceWhiteXyz", "referenceWhiteValue", "whiteBalanceApplication", "captureSaturation", "appliedTransforms", "storage"]);
|
|
101
|
+
const state = enumValue(r.imageState, ["scene-referred-xyz", "virtual-sensor-channels", "color-transformed-linear-rgb"]);
|
|
102
|
+
const binding = enumValue(r.rasterBinding, ["oriented-active-capture", "output"]);
|
|
103
|
+
const dimensions = binding === "output" ? resolved.output.raster : resolved.orientedCapture.raster;
|
|
104
|
+
const width = integer(r.pixelWidth), height = integer(r.pixelHeight), channels = array(r.channelIds, 32).map(id);
|
|
105
|
+
const count = width * height * channels.length;
|
|
106
|
+
if (width !== dimensions.pixelWidth || height !== dimensions.pixelHeight || !channels.length ||
|
|
107
|
+
new Set(channels).size !== channels.length || !Number.isSafeInteger(count))
|
|
108
|
+
throw new InvalidConfigurationError("Plane raster/channel identity mismatch.");
|
|
109
|
+
const requiredChannels = state === "scene-referred-xyz" ? ["X", "Y", "Z"] : state === "color-transformed-linear-rgb" ? ["red", "green", "blue"] : null;
|
|
110
|
+
if (requiredChannels && JSON.stringify(channels) !== JSON.stringify(requiredChannels))
|
|
111
|
+
throw new InvalidConfigurationError("Channels do not match image state.");
|
|
112
|
+
const colorProfile = r.colorProfile === null ? null : profile(r.colorProfile), referenceWhite = white(r.encodingReferenceWhiteXyz);
|
|
113
|
+
if (state === "virtual-sensor-channels" ? referenceWhite !== null || colorProfile === null : referenceWhite === null || colorProfile === null) {
|
|
114
|
+
throw new InvalidConfigurationError("Color metadata does not match image state.");
|
|
115
|
+
}
|
|
116
|
+
if (state === "scene-referred-xyz" && (colorProfile.id !== "cie-1931-2-degree-xyz" || colorProfile.version !== "1.0.0")) {
|
|
117
|
+
throw new InvalidConfigurationError("XYZ planes require the explicit CIE 1931 2-degree identity.");
|
|
118
|
+
}
|
|
119
|
+
const application = enumValue(r.whiteBalanceApplication, ["intent-only", "applied-rgb-gains", "applied-chromatic-adaptation", "not-applicable"]);
|
|
120
|
+
if (((application === "intent-only" || application === "applied-rgb-gains") && intent === null) ||
|
|
121
|
+
(application === "applied-rgb-gains" && JSON.stringify(channels) !== JSON.stringify(["red", "green", "blue"]))) {
|
|
122
|
+
throw new InvalidConfigurationError("WB application must refer to a resolved compatible RGB intent.");
|
|
123
|
+
}
|
|
124
|
+
const s = object(r.storage, ["kind", "samples", "artifactId", "sha256", "sampleCount", "byteOrder"]);
|
|
125
|
+
const kind = enumValue(s.kind, ["inline-float64", "external-float32", "external-float64"]);
|
|
126
|
+
let storage;
|
|
127
|
+
if (kind === "inline-float64") {
|
|
128
|
+
if (s.artifactId !== undefined || s.sha256 !== undefined || s.sampleCount !== undefined || s.byteOrder !== undefined)
|
|
129
|
+
throw new InvalidConfigurationError("Inline plane cannot contain external storage fields.");
|
|
130
|
+
const samples = array(s.samples, 1_000_000).map((v) => number(v));
|
|
131
|
+
if (samples.length !== count)
|
|
132
|
+
throw new InvalidConfigurationError("Plane sample count mismatch.");
|
|
133
|
+
storage = { kind, samples };
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
if (s.samples !== undefined || integer(s.sampleCount) !== count)
|
|
137
|
+
throw new InvalidConfigurationError("External plane sample count/fields mismatch.");
|
|
138
|
+
storage = { kind, byteOrder: enumValue(s.byteOrder, ["little-endian"]), artifactId: id(s.artifactId), sha256: digest(s.sha256), sampleCount: count };
|
|
139
|
+
}
|
|
140
|
+
const saturation = object(r.captureSaturation, ["kind", "whiteLevel", "upstreamClippedSampleCount"]);
|
|
141
|
+
const saturationKind = enumValue(saturation.kind, ["not-modeled", "declared-virtual-white"]);
|
|
142
|
+
let captureSaturation;
|
|
143
|
+
if (saturationKind === "not-modeled") {
|
|
144
|
+
if (saturation.whiteLevel !== undefined || saturation.upstreamClippedSampleCount !== undefined)
|
|
145
|
+
throw new InvalidConfigurationError("Unmodeled saturation cannot assert a white level.");
|
|
146
|
+
captureSaturation = { kind: saturationKind };
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const clipped = integer(saturation.upstreamClippedSampleCount, 0);
|
|
150
|
+
if (clipped > count)
|
|
151
|
+
throw new InvalidConfigurationError("Invalid clipped sample count.");
|
|
152
|
+
captureSaturation = { kind: saturationKind, whiteLevel: number(saturation.whiteLevel, true), upstreamClippedSampleCount: clipped };
|
|
153
|
+
}
|
|
154
|
+
const transforms = array(r.appliedTransforms, 64).map((value) => {
|
|
155
|
+
const t = object(value, ["profile", "kind"]);
|
|
156
|
+
return { profile: profile(t.profile), kind: enumValue(t.kind, ["linear-color", "chromatic-adaptation", "digital-lens-correction"]) };
|
|
157
|
+
});
|
|
158
|
+
if (state === "color-transformed-linear-rgb" && !transforms.some((t) => t.kind === "linear-color"))
|
|
159
|
+
throw new InvalidConfigurationError("Transformed RGB requires explicit color-transform history.");
|
|
160
|
+
if (application === "applied-chromatic-adaptation" && (state !== "color-transformed-linear-rgb" ||
|
|
161
|
+
!transforms.some((t) => t.kind === "chromatic-adaptation")))
|
|
162
|
+
throw new InvalidConfigurationError("Applied adaptation requires transformed RGB and adaptation history.");
|
|
163
|
+
return { id: id(r.id), imageStateId: id(r.imageStateId), imageState: state, rasterBinding: binding, pixelWidth: width, pixelHeight: height,
|
|
164
|
+
channelIds: channels, colorProfile, encodingReferenceWhiteXyz: referenceWhite, referenceWhiteValue: number(r.referenceWhiteValue, true),
|
|
165
|
+
whiteBalanceApplication: application, captureSaturation, appliedTransforms: transforms, storage };
|
|
166
|
+
}
|
|
167
|
+
function normalize(value, apiVersion) {
|
|
168
|
+
const r = object(value, ["captureId", "sceneStateId", "sceneTimeSeconds", "geometry", "exposure", "focus", "noise", "source",
|
|
169
|
+
"whiteBalanceIntent", "adoptedWhiteXyz", "models", "planes"]);
|
|
170
|
+
const g = geometry(r.geometry), resolved = resolveCaptureGeometry(g).value;
|
|
171
|
+
const e = object(r.exposure, ["focalLengthMm", "aperture", "shutterSeconds", "iso"]);
|
|
172
|
+
const exposure = { focalLengthMm: number(e.focalLengthMm, true), aperture: number(e.aperture, true),
|
|
173
|
+
shutterSeconds: number(e.shutterSeconds, true), iso: number(e.iso, true) };
|
|
174
|
+
const f = object(r.focus, ["kind", "distanceM"]), focus = parseFocusPlane(f);
|
|
175
|
+
const noise = object(r.noise, ["seedUint32", "realizationId", "model"]), seed = integer(noise.seedUint32, 0);
|
|
176
|
+
if (seed > 0xffffffff)
|
|
177
|
+
throw new InvalidConfigurationError("Noise seed must be uint32.");
|
|
178
|
+
const source = object(r.source, ["kind", "artifactId", "sha256", "dynamicRangeHistory"]);
|
|
179
|
+
const time = number(r.sceneTimeSeconds), intent = wb(r.whiteBalanceIntent);
|
|
180
|
+
if (time < 0)
|
|
181
|
+
throw new InvalidConfigurationError("Scene time must be nonnegative.");
|
|
182
|
+
const models = array(r.models, 128).map((value) => {
|
|
183
|
+
const m = object(value, ["profile", "scientificStatus", "publicEvidenceIds"]), evidence = array(m.publicEvidenceIds, 128).map(id);
|
|
184
|
+
if (!evidence.length || new Set(evidence).size !== evidence.length)
|
|
185
|
+
throw new InvalidConfigurationError("Public evidence IDs must be nonempty/unique.");
|
|
186
|
+
return { profile: profile(m.profile), scientificStatus: enumValue(m.scientificStatus, ["calculated", "calibrated", "estimated", "approximation"]), publicEvidenceIds: evidence };
|
|
187
|
+
});
|
|
188
|
+
const planes = array(r.planes, 32).map((p) => plane(p, resolved, intent));
|
|
189
|
+
const adoptedWhite = white(r.adoptedWhiteXyz);
|
|
190
|
+
if (planes.some((p) => p.whiteBalanceApplication === "applied-chromatic-adaptation") && adoptedWhite === null) {
|
|
191
|
+
throw new InvalidConfigurationError("Applied adaptation requires an adopted white.");
|
|
192
|
+
}
|
|
193
|
+
if (!models.length || !planes.length || new Set(models.map((m) => m.profile.id)).size !== models.length ||
|
|
194
|
+
new Set(planes.map((p) => p.id)).size !== planes.length || new Set(planes.map((p) => p.imageStateId)).size !== planes.length ||
|
|
195
|
+
planes.reduce((n, p) => n + (p.storage.kind === "inline-float64" ? p.storage.samples.length : 0), 0) > 1_000_000) {
|
|
196
|
+
throw new InvalidConfigurationError("Capture needs unique models/planes/states and a bounded inline sample budget.");
|
|
197
|
+
}
|
|
198
|
+
return freezeOwnedData({ schemaVersion: SIMULATED_CAPTURE_SCHEMA_VERSION, engineApiVersion: id(apiVersion),
|
|
199
|
+
captureId: id(r.captureId), sceneStateId: id(r.sceneStateId), sceneTimeSeconds: time, geometry: g, resolvedGeometry: resolved,
|
|
200
|
+
exposure, equivalentFocalLength35Mm: calculateEquivalentFocalLength35Mm({ focalLengthMm: exposure.focalLengthMm, activeImagingArea: resolved.activeCapture.imagingArea }).value.equivalentFocalLength35Mm,
|
|
201
|
+
focus, noise: { seedUint32: seed, realizationId: id(noise.realizationId), model: profile(noise.model) },
|
|
202
|
+
source: { kind: enumValue(source.kind, ["scene-linear-master", "sensor-derived-linear", "color-transformed-linear-master"]),
|
|
203
|
+
artifactId: id(source.artifactId), sha256: digest(source.sha256), dynamicRangeHistory: enumValue(source.dynamicRangeHistory, ["unknown", "no-loss-declared", "upstream-clipped"]) },
|
|
204
|
+
whiteBalanceIntent: intent, adoptedWhiteXyz: adoptedWhite, models, planes });
|
|
205
|
+
}
|
|
206
|
+
/** Commits a format-neutral float master manifest; no radiance generation, clamp, WB or export encoding. */
|
|
207
|
+
export function createSimulatedCapture(input) {
|
|
208
|
+
return calculatedResult(normalize(input, ENGINE_API_VERSION), "authoritative-linear-capture-container", "0.1.0", ["Structural commitment only; upstream scientific statuses remain independent", "Master/source declarations do not prove source fidelity", "No tone mapping, recovered headroom, physical sensor calibration or serializer inferred"]);
|
|
209
|
+
}
|
|
210
|
+
/** Parses an archived capture, recomputing and checking all derived geometry/focal metadata. */
|
|
211
|
+
export function parseSimulatedCapture(value) {
|
|
212
|
+
const r = object(value, ["schemaVersion", "engineApiVersion", "captureId", "sceneStateId", "sceneTimeSeconds", "geometry", "resolvedGeometry",
|
|
213
|
+
"equivalentFocalLength35Mm", "exposure", "focus", "noise", "source", "whiteBalanceIntent", "adoptedWhiteXyz", "models", "planes"]);
|
|
214
|
+
if (r.schemaVersion !== SIMULATED_CAPTURE_SCHEMA_VERSION && r.schemaVersion !== "0.1.0")
|
|
215
|
+
throw new InvalidConfigurationError("Unsupported capture schema.");
|
|
216
|
+
if (r.schemaVersion === "0.1.0" && Array.isArray(r.planes) && r.planes.some((p) => p?.whiteBalanceApplication === "applied-chromatic-adaptation")) {
|
|
217
|
+
throw new InvalidConfigurationError("Legacy capture schema cannot declare the new adaptation state.");
|
|
218
|
+
}
|
|
219
|
+
const { schemaVersion: _schemaVersion, engineApiVersion, resolvedGeometry, equivalentFocalLength35Mm, ...input } = r;
|
|
220
|
+
const result = normalize(input, id(engineApiVersion));
|
|
221
|
+
if (canonical(resolvedGeometry) !== canonical(result.resolvedGeometry) || equivalentFocalLength35Mm !== result.equivalentFocalLength35Mm) {
|
|
222
|
+
throw new InvalidConfigurationError("Archived derived capture metadata is inconsistent.");
|
|
223
|
+
}
|
|
224
|
+
// _schemaVersion is already checked, not copied as an unchecked discriminator.
|
|
225
|
+
void _schemaVersion;
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
function canonical(value) {
|
|
229
|
+
return stringifyCanonicalJson(value, {
|
|
230
|
+
undefinedObjectProperties: "reject",
|
|
231
|
+
nonFiniteNumberMessage: "Capture number must be finite with valid sign.",
|
|
232
|
+
unsupportedValueMessage: "Derived capture metadata must be finite JSON."
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
/** Canonical allowlisted JSON, including semantic samples/IDs, not private caches or file layout. */
|
|
236
|
+
export function serializeSimulatedCapture(input) {
|
|
237
|
+
return JSON.stringify(parseSimulatedCapture(input.capture));
|
|
238
|
+
}
|
|
239
|
+
/** Requires an exact plane image state; callers may not substitute another kind of 'linear'. */
|
|
240
|
+
export function resolveSimulatedCapturePlane(input) {
|
|
241
|
+
const capture = parseSimulatedCapture(input.capture);
|
|
242
|
+
const state = enumValue(input.requiredImageState, ["scene-referred-xyz", "virtual-sensor-channels", "color-transformed-linear-rgb"]);
|
|
243
|
+
const result = capture.planes.find((p) => p.id === id(input.planeId));
|
|
244
|
+
if (!result || result.imageState !== state)
|
|
245
|
+
throw new InvalidConfigurationError("Capture plane missing or incompatible image state.");
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=simulated-capture.js.map
|
|
@@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CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU,KAAK,KAAK;QAAE,MAAM,IAAI,yBAAyB,CAAC,oDAAoD,CAAC,CAAC;IACtI,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type CalculationResult } from "../core/calculation-result.js";
|
|
2
|
+
import { type SimulatedCapture, type CaptureLinearPlane, type CapturePublicProfileReference } from "../capture/simulated-capture.js";
|
|
3
|
+
export declare const CAPTURE_COLOR_MODEL_VERSION: "0.1.0";
|
|
4
|
+
/** Explicit ideal colorimetric camera, not measured spectral sensor channels. */
|
|
5
|
+
export declare const VIRTUAL_COLOR_CAMERA_PROFILE: Readonly<{
|
|
6
|
+
id: "photivra-colorimetric-rgb-d65";
|
|
7
|
+
version: "0.1.0";
|
|
8
|
+
}>;
|
|
9
|
+
/** Linear light, sRGB primaries/D65; no sRGB transfer curve is applied. */
|
|
10
|
+
export declare const LINEAR_CAPTURE_RGB_PROFILE: Readonly<{
|
|
11
|
+
id: "linear-srgb-d65";
|
|
12
|
+
version: "0.1.0";
|
|
13
|
+
}>;
|
|
14
|
+
type Vector = readonly [number, number, number];
|
|
15
|
+
type Matrix = readonly [Vector, Vector, Vector];
|
|
16
|
+
/** One explicit color interpretation; gains and adaptation cannot silently double-apply WB. */
|
|
17
|
+
export type CaptureColorWhiteBalance = {
|
|
18
|
+
kind: "preserve-intent";
|
|
19
|
+
} | {
|
|
20
|
+
kind: "apply-resolved-rgb-gains";
|
|
21
|
+
channelBasis: CapturePublicProfileReference;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "adopted-white-xyz-scaling";
|
|
24
|
+
};
|
|
25
|
+
/** IDs identify a new derived plane; source capture stays immutable. */
|
|
26
|
+
export interface CaptureColorTransformInput {
|
|
27
|
+
capture: SimulatedCapture;
|
|
28
|
+
sourcePlaneId: string;
|
|
29
|
+
outputPlaneId: string;
|
|
30
|
+
outputImageStateId: string;
|
|
31
|
+
whiteBalance: CaptureColorWhiteBalance;
|
|
32
|
+
}
|
|
33
|
+
/** Profile data exposes complete row-major matrices and domain conditions to consumers. */
|
|
34
|
+
export interface CaptureColorModel {
|
|
35
|
+
version: typeof CAPTURE_COLOR_MODEL_VERSION;
|
|
36
|
+
cameraProfile: CapturePublicProfileReference;
|
|
37
|
+
outputProfile: CapturePublicProfileReference;
|
|
38
|
+
referenceIlluminant: "D65";
|
|
39
|
+
observer: "cie-1931-2-degree";
|
|
40
|
+
referenceWhiteXyz: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: 1;
|
|
43
|
+
z: number;
|
|
44
|
+
};
|
|
45
|
+
cameraRgbToXyz: Matrix;
|
|
46
|
+
xyzToCameraRgb: Matrix;
|
|
47
|
+
scientificStatus: "calculated";
|
|
48
|
+
validConditions: readonly string[];
|
|
49
|
+
publicEvidenceIds: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
/** Returns the versioned ideal camera basis, independent of rendering/serializer state. */
|
|
52
|
+
export declare function resolveCaptureColorModel(): CaptureColorModel;
|
|
53
|
+
/** Validates the entire capture and explicit transform policy across untrusted JSON boundaries. */
|
|
54
|
+
export declare function parseCaptureColorTransformInput(value: unknown): CaptureColorTransformInput;
|
|
55
|
+
export interface CaptureColorTransformResult {
|
|
56
|
+
plane: CaptureLinearPlane;
|
|
57
|
+
colorModel: CaptureColorModel;
|
|
58
|
+
sourcePlaneId: string;
|
|
59
|
+
sourceImageStateId: string;
|
|
60
|
+
whiteBalance: CaptureColorWhiteBalance;
|
|
61
|
+
/** Matrix on CIE XYZ, identity when no adaptation; row-major, dimensionless. */
|
|
62
|
+
chromaticAdaptationMatrix: Matrix;
|
|
63
|
+
/** False: even adopted-white scaling is a camera choice under mixed illumination. */
|
|
64
|
+
claimsUniqueSceneWhite: false;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Converts a bounded inline XYZ/ideal-camera plane to unclamped linear sRGB.
|
|
68
|
+
* Reuses resolved WB intent; never estimates illumination or changes exposure/noise.
|
|
69
|
+
* XYZ diagonal adaptation is explicitly an approximation, distinct from RGB gains.
|
|
70
|
+
*/
|
|
71
|
+
export declare function calculateCaptureColorTransform(input: CaptureColorTransformInput): CalculationResult<CaptureColorTransformResult>;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=capture-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-color.d.ts","sourceRoot":"","sources":["../../src/color/capture-color.ts"],"names":[],"mappings":"AAUA,OAAO,EAAyC,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAG9G,OAAO,EAAyB,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,KAAK,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAE5J,eAAO,MAAM,2BAA2B,EAAG,OAAgB,CAAC;AAC5D,iFAAiF;AACjF,eAAO,MAAM,4BAA4B;;;EAA+F,CAAC;AACzI,2EAA2E;AAC3E,eAAO,MAAM,0BAA0B;;;EAAiF,CAAC;AAEzH,KAAK,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAChD,KAAK,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAmBhD,+FAA+F;AAC/F,MAAM,MAAM,wBAAwB,GAChC;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,0BAA0B,CAAC;IAAC,YAAY,EAAE,6BAA6B,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,2BAA2B,CAAA;CAAE,CAAC;AAC1C,wEAAwE;AACxE,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC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the versioned ideal camera basis, independent of rendering/serializer state.
|
|
5
|
+
* Validates the entire capture and explicit transform policy across untrusted JSON boundaries.
|
|
6
|
+
* @see docs/CAPTURE_COLOR.md for equations, coordinate/unit conventions, blockers and support limits.
|
|
7
|
+
*/
|
|
8
|
+
import { requireAllowlistedRecord, requirePublicOpaqueId } from "../core/record-validation.js";
|
|
9
|
+
import { calculatedResult, approximationResult } from "../core/calculation-result.js";
|
|
10
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
11
|
+
import { InvalidScientificResultError } from "../core/validation.js";
|
|
12
|
+
import { parseSimulatedCapture } from "../capture/simulated-capture.js";
|
|
13
|
+
export const CAPTURE_COLOR_MODEL_VERSION = "0.1.0";
|
|
14
|
+
/** Explicit ideal colorimetric camera, not measured spectral sensor channels. */
|
|
15
|
+
export const VIRTUAL_COLOR_CAMERA_PROFILE = Object.freeze({ id: "photivra-colorimetric-rgb-d65", version: CAPTURE_COLOR_MODEL_VERSION });
|
|
16
|
+
/** Linear light, sRGB primaries/D65; no sRGB transfer curve is applied. */
|
|
17
|
+
export const LINEAR_CAPTURE_RGB_PROFILE = Object.freeze({ id: "linear-srgb-d65", version: CAPTURE_COLOR_MODEL_VERSION });
|
|
18
|
+
const D65 = Object.freeze({ x: .3127 / .3290, y: 1, z: (1 - .3127 - .3290) / .3290 });
|
|
19
|
+
const IDENTITY = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
|
|
20
|
+
function multiply(m, v) {
|
|
21
|
+
return m.map((r) => r[0] * v[0] + r[1] * v[1] + r[2] * v[2]);
|
|
22
|
+
}
|
|
23
|
+
function inverse(m) {
|
|
24
|
+
const [[a, b, c], [d, e, f], [g, h, i]] = m;
|
|
25
|
+
const determinant = a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g);
|
|
26
|
+
return [[e * i - f * h, c * h - b * i, b * f - c * e], [f * g - d * i, a * i - c * g, c * d - a * f], [d * h - e * g, b * g - a * h, a * e - b * d]]
|
|
27
|
+
.map((r) => r.map((v) => v / determinant));
|
|
28
|
+
}
|
|
29
|
+
// Independently derive the basis from public primary chromaticities, not a copied matrix.
|
|
30
|
+
const primaries = [[.64, .33], [.30, .60], [.15, .06]];
|
|
31
|
+
const columns = primaries.map(([x, y]) => [x / y, 1, (1 - x - y) / y]);
|
|
32
|
+
const basis = [0, 1, 2].map((i) => columns.map((c) => c[i]));
|
|
33
|
+
const scales = multiply(inverse(basis), [D65.x, 1, D65.z]);
|
|
34
|
+
const RGB_TO_XYZ = basis.map((row) => row.map((v, i) => v * scales[i]));
|
|
35
|
+
const XYZ_TO_RGB = inverse(RGB_TO_XYZ);
|
|
36
|
+
/** Returns the versioned ideal camera basis, independent of rendering/serializer state. */
|
|
37
|
+
export function resolveCaptureColorModel() {
|
|
38
|
+
return { version: CAPTURE_COLOR_MODEL_VERSION, cameraProfile: { ...VIRTUAL_COLOR_CAMERA_PROFILE },
|
|
39
|
+
outputProfile: { ...LINEAR_CAPTURE_RGB_PROFILE }, referenceIlluminant: "D65", observer: "cie-1931-2-degree",
|
|
40
|
+
referenceWhiteXyz: { ...D65 }, cameraRgbToXyz: RGB_TO_XYZ.map((r) => [...r]),
|
|
41
|
+
xyzToCameraRgb: XYZ_TO_RGB.map((r) => [...r]), scientificStatus: "calculated",
|
|
42
|
+
validConditions: ["Ideal colorimetric basis only; virtual RGB is an invertible encoding of CIE XYZ",
|
|
43
|
+
"Not spectral channels, electrons, commercial-camera RGB or a sensor calibration",
|
|
44
|
+
"Signed finite scene-linear values; co-sited RGB; no transfer curve, gamut mapping or clipping"],
|
|
45
|
+
publicEvidenceIds: ["w3c:css-color-4:srgb-primaries-d65"] };
|
|
46
|
+
}
|
|
47
|
+
function record(v, keys) {
|
|
48
|
+
return requireAllowlistedRecord(v, keys, "Invalid color-transform fields.");
|
|
49
|
+
}
|
|
50
|
+
function publicId(v) {
|
|
51
|
+
return requirePublicOpaqueId(v, "Invalid public color ID.");
|
|
52
|
+
}
|
|
53
|
+
/** Validates the entire capture and explicit transform policy across untrusted JSON boundaries. */
|
|
54
|
+
export function parseCaptureColorTransformInput(value) {
|
|
55
|
+
const r = record(value, ["capture", "sourcePlaneId", "outputPlaneId", "outputImageStateId", "whiteBalance"]);
|
|
56
|
+
const w = record(r.whiteBalance, ["kind", "channelBasis"]);
|
|
57
|
+
let whiteBalance;
|
|
58
|
+
if (w.kind === "apply-resolved-rgb-gains") {
|
|
59
|
+
const p = record(w.channelBasis, ["id", "version"]);
|
|
60
|
+
whiteBalance = { kind: w.kind, channelBasis: { id: publicId(p.id), version: publicId(p.version) } };
|
|
61
|
+
}
|
|
62
|
+
else if ((w.kind === "preserve-intent" || w.kind === "adopted-white-xyz-scaling") && w.channelBasis === undefined) {
|
|
63
|
+
whiteBalance = { kind: w.kind };
|
|
64
|
+
}
|
|
65
|
+
else
|
|
66
|
+
throw new InvalidConfigurationError("Unsupported or contradictory color WB policy.");
|
|
67
|
+
return { capture: parseSimulatedCapture(r.capture), sourcePlaneId: publicId(r.sourcePlaneId),
|
|
68
|
+
outputPlaneId: publicId(r.outputPlaneId), outputImageStateId: publicId(r.outputImageStateId), whiteBalance };
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Converts a bounded inline XYZ/ideal-camera plane to unclamped linear sRGB.
|
|
72
|
+
* Reuses resolved WB intent; never estimates illumination or changes exposure/noise.
|
|
73
|
+
* XYZ diagonal adaptation is explicitly an approximation, distinct from RGB gains.
|
|
74
|
+
*/
|
|
75
|
+
export function calculateCaptureColorTransform(input) {
|
|
76
|
+
const { capture, sourcePlaneId, outputPlaneId, outputImageStateId, whiteBalance } = parseCaptureColorTransformInput(input);
|
|
77
|
+
const source = capture.planes.find((p) => p.id === sourcePlaneId);
|
|
78
|
+
if (!source || source.storage.kind !== "inline-float64" || source.imageState === "color-transformed-linear-rgb" ||
|
|
79
|
+
source.whiteBalanceApplication === "applied-rgb-gains" || source.whiteBalanceApplication === "applied-chromatic-adaptation" ||
|
|
80
|
+
source.appliedTransforms.some((t) => t.kind !== "digital-lens-correction")) {
|
|
81
|
+
throw new InvalidConfigurationError("Color requires an untreated inline XYZ or supported virtual camera plane.");
|
|
82
|
+
}
|
|
83
|
+
if (capture.planes.some((p) => p.id === outputPlaneId || p.imageStateId === outputImageStateId)) {
|
|
84
|
+
throw new InvalidConfigurationError("Derived color plane/state IDs must be new.");
|
|
85
|
+
}
|
|
86
|
+
const virtual = source.imageState === "virtual-sensor-channels";
|
|
87
|
+
if (virtual && (source.colorProfile?.id !== VIRTUAL_COLOR_CAMERA_PROFILE.id || source.colorProfile.version !== CAPTURE_COLOR_MODEL_VERSION ||
|
|
88
|
+
JSON.stringify(source.channelIds) !== JSON.stringify(["red", "green", "blue"]))) {
|
|
89
|
+
throw new InvalidConfigurationError("Unresolved spectral/sensor RGB cannot use the ideal colorimetric transform.");
|
|
90
|
+
}
|
|
91
|
+
const adapt = whiteBalance.kind === "adopted-white-xyz-scaling";
|
|
92
|
+
const reference = source.encodingReferenceWhiteXyz;
|
|
93
|
+
if (!virtual && !adapt && (reference.x !== D65.x || reference.z !== D65.z)) {
|
|
94
|
+
throw new InvalidConfigurationError("A different XYZ reference white requires an explicit adaptation choice.");
|
|
95
|
+
}
|
|
96
|
+
const gains = whiteBalance.kind === "apply-resolved-rgb-gains";
|
|
97
|
+
if (gains && (!capture.whiteBalanceIntent || whiteBalance.channelBasis.id !== VIRTUAL_COLOR_CAMERA_PROFILE.id ||
|
|
98
|
+
whiteBalance.channelBasis.version !== CAPTURE_COLOR_MODEL_VERSION)) {
|
|
99
|
+
throw new InvalidConfigurationError("Resolved WB gains require an explicit matching camera channel-basis binding.");
|
|
100
|
+
}
|
|
101
|
+
let adaptation = IDENTITY;
|
|
102
|
+
if (adapt) {
|
|
103
|
+
const white = capture.adoptedWhiteXyz;
|
|
104
|
+
if (!white)
|
|
105
|
+
throw new InvalidConfigurationError("Adopted-white adaptation requires an explicit adopted XYZ white.");
|
|
106
|
+
const x = D65.x / white.x, z = D65.z / white.z;
|
|
107
|
+
if (!Number.isFinite(x) || !Number.isFinite(z) || x < 1e-6 || x > 1e6 || z < 1e-6 || z > 1e6) {
|
|
108
|
+
throw new InvalidConfigurationError("Adopted-white scaling is outside the declared numerical domain.");
|
|
109
|
+
}
|
|
110
|
+
adaptation = [[x, 0, 0], [0, 1, 0], [0, 0, z]];
|
|
111
|
+
}
|
|
112
|
+
const samples = [], values = source.storage.samples;
|
|
113
|
+
for (let i = 0; i < values.length; i += 3) {
|
|
114
|
+
const v = [values[i], values[i + 1], values[i + 2]];
|
|
115
|
+
let rgb = virtual && !adapt ? v : multiply(XYZ_TO_RGB, multiply(adaptation, virtual ? multiply(RGB_TO_XYZ, v) : v));
|
|
116
|
+
if (gains) {
|
|
117
|
+
const g = capture.whiteBalanceIntent.channelGains;
|
|
118
|
+
rgb = [rgb[0] * g.red, rgb[1] * g.green, rgb[2] * g.blue];
|
|
119
|
+
}
|
|
120
|
+
if (rgb.some((v) => !Number.isFinite(v)))
|
|
121
|
+
throw new InvalidScientificResultError("Color transform produced a non-finite sample.");
|
|
122
|
+
samples.push(...rgb.map((v) => Object.is(v, -0) ? 0 : v));
|
|
123
|
+
}
|
|
124
|
+
const transforms = [...source.appliedTransforms];
|
|
125
|
+
if (adapt)
|
|
126
|
+
transforms.push({ profile: { id: "photivra-xyz-diagonal-adaptation", version: CAPTURE_COLOR_MODEL_VERSION }, kind: "chromatic-adaptation" });
|
|
127
|
+
transforms.push({ profile: { ...LINEAR_CAPTURE_RGB_PROFILE }, kind: "linear-color" });
|
|
128
|
+
if (gains)
|
|
129
|
+
transforms.push({ profile: { id: capture.whiteBalanceIntent.stateId, version: CAPTURE_COLOR_MODEL_VERSION }, kind: "linear-color" });
|
|
130
|
+
const plane = { ...source, id: outputPlaneId, imageStateId: outputImageStateId,
|
|
131
|
+
imageState: "color-transformed-linear-rgb", channelIds: ["red", "green", "blue"], colorProfile: { ...LINEAR_CAPTURE_RGB_PROFILE },
|
|
132
|
+
encodingReferenceWhiteXyz: { ...D65 }, appliedTransforms: transforms,
|
|
133
|
+
whiteBalanceApplication: gains ? "applied-rgb-gains" : adapt ? "applied-chromatic-adaptation" : capture.whiteBalanceIntent ? "intent-only" : "not-applicable",
|
|
134
|
+
storage: { kind: "inline-float64", samples } };
|
|
135
|
+
// Validation enforces capture-wide sample budget, identities and output finiteness.
|
|
136
|
+
const checked = parseSimulatedCapture({ ...capture, planes: [plane] }).planes[0];
|
|
137
|
+
const result = { plane: checked, colorModel: resolveCaptureColorModel(), sourcePlaneId,
|
|
138
|
+
sourceImageStateId: source.imageStateId, whiteBalance, chromaticAdaptationMatrix: adaptation.map((r) => [...r]),
|
|
139
|
+
claimsUniqueSceneWhite: false };
|
|
140
|
+
const assumptions = ["Ideal CIE colorimetric virtual camera only; no sensor calibration inferred", "Source exposure/noise/saturation history retained; float samples never clipped",
|
|
141
|
+
"WB intent, applied RGB gains and adopted-white adaptation are independent choices; no scene-white oracle"];
|
|
142
|
+
return adapt ? approximationResult(result, "capture-color-xyz-diagonal-adaptation", CAPTURE_COLOR_MODEL_VERSION, [...assumptions, "XYZ diagonal scaling is a limited chromatic-adaptation approximation, not Bradford or a color-appearance model"])
|
|
143
|
+
: calculatedResult(result, "capture-colorimetric-linear-rgb", CAPTURE_COLOR_MODEL_VERSION, assumptions);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=capture-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-color.js","sourceRoot":"","sources":["../../src/color/capture-color.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;GAKG;AAEH,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAA0B,MAAM,+BAA+B,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC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AG,WAAW,EAAE,gHAAgH,CAAC,CAAC;QACnI,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,iCAAiC,EAAE,2BAA2B,EAAE,WAAW,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type Matrix = readonly (readonly number[])[];
|
|
2
|
+
/** Validated 3×3 matrices only; retains the declared determinant/inverse bounds. */
|
|
3
|
+
export declare function invertSensorColorMatrix(m: Matrix): number[][];
|
|
4
|
+
interface SensorColorDevelopment {
|
|
5
|
+
referenceWhiteXyz: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: 1;
|
|
8
|
+
z: number;
|
|
9
|
+
};
|
|
10
|
+
develop(values: readonly number[]): number[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Internal adapter for validated normalized sensor RGB and declared D65 profile.
|
|
14
|
+
* The caller owns profile evidence, CFA/basis binding and one-time WB authorization.
|
|
15
|
+
* This is distinct from the ideal virtual-camera transform: gains act in sensor
|
|
16
|
+
* channels before camera-to-XYZ, followed by XYZ-to-linear-sRGB. No clipping,
|
|
17
|
+
* adaptation, calibration inference, geometry or container metadata is performed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function prepareSensorColorDevelopment(cameraChannelsToXyz: Matrix, gains: readonly number[]): SensorColorDevelopment;
|
|
20
|
+
/** Camera coordinates of the declared D65 white; container policy remains caller-owned. */
|
|
21
|
+
export declare function sensorColorReferenceWhite(xyzToCamera: Matrix): number[];
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=sensor-color-development.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sensor-color-development.d.ts","sourceRoot":"","sources":["../../src/color/sensor-color-development.ts"],"names":[],"mappings":"AAiBA,KAAK,MAAM,GAAG,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;AAU7C,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAM7D;AAED,UAAU,sBAAsB;IAC9B,iBAAiB,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,sBAAsB,CAS3H;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAGvE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Module boundary and integration notes.
|
|
4
|
+
* Validated 3×3 matrices only; retains the declared determinant/inverse bounds.
|
|
5
|
+
* Internal adapter for validated normalized sensor RGB and declared D65 profile. The caller owns
|
|
6
|
+
* profile evidence, CFA/basis binding and one-time WB authorization. This is distinct from the ideal
|
|
7
|
+
* virtual-camera transform: gains act in sensor channels before camera-to-XYZ, followed by
|
|
8
|
+
* XYZ-to-linear-sRGB. No clipping, adaptation, calibration inference, geometry or container metadata
|
|
9
|
+
* is performed.
|
|
10
|
+
* @see docs/PHOTOGRAPHIC_EXPORT.md for equations, coordinate/unit conventions, blockers and support
|
|
11
|
+
* limits.
|
|
12
|
+
*/
|
|
13
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
14
|
+
import { resolveCaptureColorModel } from "./capture-color.js";
|
|
15
|
+
/**
|
|
16
|
+
* Multiply the validated channel vector in its declared basis. Preserve operation
|
|
17
|
+
* order: sensor gains precede camera-to-XYZ, then XYZ-to-linear-sRGB. This internal
|
|
18
|
+
* path accepts neither arbitrary spectral channels nor the ideal virtual-camera
|
|
19
|
+
* basis by implication, and performs no clipping or chromatic adaptation.
|
|
20
|
+
*/
|
|
21
|
+
function multiply(m, values) {
|
|
22
|
+
return m.map((row) => row.reduce((sum, v, i) => sum + v * values[i], 0));
|
|
23
|
+
}
|
|
24
|
+
/** Validated 3×3 matrices only; retains the declared determinant/inverse bounds. */
|
|
25
|
+
export function invertSensorColorMatrix(m) {
|
|
26
|
+
const [a, b, c, d, e, f, g, h, i] = m.flat(), det = a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g);
|
|
27
|
+
if (!Number.isFinite(det) || Math.abs(det) < 1e-9)
|
|
28
|
+
throw new InvalidConfigurationError("Export color matrix is singular or outside supported conditioning.");
|
|
29
|
+
const result = [[e * i - f * h, c * h - b * i, b * f - c * e], [f * g - d * i, a * i - c * g, c * d - a * f], [d * h - e * g, b * g - a * h, a * e - b * d]].map((r) => r.map((v) => v / det));
|
|
30
|
+
if (result.flat().some((v) => !Number.isFinite(v) || Math.abs(v) > 100))
|
|
31
|
+
throw new InvalidConfigurationError("Export inverse color matrix exceeds supported range.");
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Internal adapter for validated normalized sensor RGB and declared D65 profile.
|
|
36
|
+
* The caller owns profile evidence, CFA/basis binding and one-time WB authorization.
|
|
37
|
+
* This is distinct from the ideal virtual-camera transform: gains act in sensor
|
|
38
|
+
* channels before camera-to-XYZ, followed by XYZ-to-linear-sRGB. No clipping,
|
|
39
|
+
* adaptation, calibration inference, geometry or container metadata is performed.
|
|
40
|
+
*/
|
|
41
|
+
export function prepareSensorColorDevelopment(cameraChannelsToXyz, gains) {
|
|
42
|
+
const model = resolveCaptureColorModel();
|
|
43
|
+
return {
|
|
44
|
+
referenceWhiteXyz: model.referenceWhiteXyz,
|
|
45
|
+
develop(values) {
|
|
46
|
+
const balanced = values.map((n, i) => n * gains[i]);
|
|
47
|
+
return multiply(model.xyzToCameraRgb, multiply(cameraChannelsToXyz, balanced));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Camera coordinates of the declared D65 white; container policy remains caller-owned. */
|
|
52
|
+
export function sensorColorReferenceWhite(xyzToCamera) {
|
|
53
|
+
const white = resolveCaptureColorModel().referenceWhiteXyz;
|
|
54
|
+
return multiply(xyzToCamera, [white.x, 1, white.z]);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=sensor-color-development.js.map
|