@photivra/engine 1.5.0 → 2.1.0
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/CHANGELOG.md +414 -6
- package/CITATION.cff +1 -1
- package/NODE_SUPPORT.md +64 -12
- package/README.md +301 -182
- package/SECURITY.md +37 -28
- package/THIRD_PARTY.md +148 -4
- package/dist/camera/equivalent-focal-length.d.ts +13 -14
- package/dist/camera/equivalent-focal-length.js +15 -13
- package/dist/camera/equivalent-focal-length.js.map +1 -1
- package/dist/camera/field-of-view.d.ts +30 -19
- package/dist/camera/field-of-view.js +67 -18
- package/dist/camera/field-of-view.js.map +1 -1
- package/dist/camera/lens-projection.d.ts +170 -0
- package/dist/camera/lens-projection.js +444 -0
- package/dist/camera/lens-projection.js.map +1 -0
- package/dist/camera/projected-object-size.d.ts +10 -11
- package/dist/camera/projected-object-size.js +12 -10
- package/dist/camera/projected-object-size.js.map +1 -1
- package/dist/capture/capture-export-metadata.d.ts +9 -10
- package/dist/capture/capture-export-metadata.js +8 -5
- package/dist/capture/capture-export-metadata.js.map +1 -1
- package/dist/capture/dng-import.d.ts +91 -0
- package/dist/capture/dng-import.js +343 -0
- package/dist/capture/dng-import.js.map +1 -0
- package/dist/capture/environment-raw-producer.d.ts +37 -17
- package/dist/capture/environment-raw-producer.js +43 -19
- package/dist/capture/environment-raw-producer.js.map +1 -1
- package/dist/capture/export-jpeg.d.ts +35 -4
- package/dist/capture/export-jpeg.js +133 -47
- package/dist/capture/export-jpeg.js.map +1 -1
- package/dist/capture/export-tiff.d.ts +48 -24
- package/dist/capture/export-tiff.js +91 -31
- package/dist/capture/export-tiff.js.map +1 -1
- package/dist/capture/focus-control.d.ts +42 -65
- package/dist/capture/focus-control.js +56 -75
- package/dist/capture/focus-control.js.map +1 -1
- package/dist/capture/host-yield-cadence.d.ts +25 -0
- package/dist/capture/host-yield-cadence.js +25 -0
- package/dist/capture/host-yield-cadence.js.map +1 -0
- package/dist/capture/linear-encoding.d.ts +14 -12
- package/dist/capture/linear-encoding.js +14 -13
- package/dist/capture/linear-encoding.js.map +1 -1
- package/dist/capture/lossless-jpeg.d.ts +27 -0
- package/dist/capture/lossless-jpeg.js +237 -0
- package/dist/capture/lossless-jpeg.js.map +1 -0
- package/dist/capture/native-environment-lean.d.ts +227 -0
- package/dist/capture/native-environment-lean.js +974 -0
- package/dist/capture/native-environment-lean.js.map +1 -0
- package/dist/capture/native-environment-optical-stage.d.ts +97 -0
- package/dist/capture/native-environment-optical-stage.js +340 -0
- package/dist/capture/native-environment-optical-stage.js.map +1 -0
- package/dist/capture/native-environment-raw.d.ts +140 -6
- package/dist/capture/native-environment-raw.js +435 -34
- package/dist/capture/native-environment-raw.js.map +1 -1
- package/dist/capture/native-raw-development.d.ts +116 -9
- package/dist/capture/native-raw-development.js +221 -62
- package/dist/capture/native-raw-development.js.map +1 -1
- package/dist/capture/native-raw-dng.d.ts +60 -0
- package/dist/capture/native-raw-dng.js +167 -0
- package/dist/capture/native-raw-dng.js.map +1 -0
- package/dist/capture/native-raw.d.ts +65 -12
- package/dist/capture/native-raw.js +81 -19
- package/dist/capture/native-raw.js.map +1 -1
- package/dist/capture/packed-sensor-raw.d.ts +160 -0
- package/dist/capture/packed-sensor-raw.js +221 -0
- package/dist/capture/packed-sensor-raw.js.map +1 -0
- package/dist/capture/photographic-export.d.ts +58 -35
- package/dist/capture/photographic-export.js +177 -70
- package/dist/capture/photographic-export.js.map +1 -1
- package/dist/capture/raw-development-kernel.d.ts +52 -0
- package/dist/capture/raw-development-kernel.js +88 -0
- package/dist/capture/raw-development-kernel.js.map +1 -0
- package/dist/capture/raw-frame-limits.d.ts +7 -7
- package/dist/capture/raw-frame-limits.js +7 -6
- package/dist/capture/raw-frame-limits.js.map +1 -1
- package/dist/capture/raw-frame-reconstruction.d.ts +8 -9
- package/dist/capture/raw-frame-reconstruction.js +9 -8
- package/dist/capture/raw-frame-reconstruction.js.map +1 -1
- package/dist/capture/raw-white-level.d.ts +55 -0
- package/dist/capture/raw-white-level.js +165 -0
- package/dist/capture/raw-white-level.js.map +1 -0
- package/dist/capture/release-sequence.d.ts +5 -7
- package/dist/capture/release-sequence.js +15 -13
- package/dist/capture/release-sequence.js.map +1 -1
- package/dist/capture/sensor-raw-frame.d.ts +5 -6
- package/dist/capture/sensor-raw-frame.js +26 -9
- package/dist/capture/sensor-raw-frame.js.map +1 -1
- package/dist/capture/sensor-raw-producer.d.ts +21 -13
- package/dist/capture/sensor-raw-producer.js +86 -25
- package/dist/capture/sensor-raw-producer.js.map +1 -1
- package/dist/capture/simulated-capture.d.ts +15 -16
- package/dist/capture/simulated-capture.js +22 -12
- package/dist/capture/simulated-capture.js.map +1 -1
- package/dist/color/camera-color-matrix.d.ts +69 -0
- package/dist/color/camera-color-matrix.js +132 -0
- package/dist/color/camera-color-matrix.js.map +1 -0
- package/dist/color/capture-color.d.ts +17 -10
- package/dist/color/capture-color.js +50 -17
- package/dist/color/capture-color.js.map +1 -1
- package/dist/color/chromatic-adaptation.d.ts +63 -0
- package/dist/color/chromatic-adaptation.js +91 -0
- package/dist/color/chromatic-adaptation.js.map +1 -0
- package/dist/color/color-difference.d.ts +104 -0
- package/dist/color/color-difference.js +205 -0
- package/dist/color/color-difference.js.map +1 -0
- package/dist/color/color-matching-functions.d.ts +168 -0
- package/dist/color/color-matching-functions.js +309 -0
- package/dist/color/color-matching-functions.js.map +1 -0
- package/dist/color/colorimetry-math.d.ts +52 -0
- package/dist/color/colorimetry-math.js +144 -0
- package/dist/color/colorimetry-math.js.map +1 -0
- package/dist/color/gamut-mapping.d.ts +54 -0
- package/dist/color/gamut-mapping.js +107 -0
- package/dist/color/gamut-mapping.js.map +1 -0
- package/dist/color/illuminants.d.ts +182 -0
- package/dist/color/illuminants.js +434 -0
- package/dist/color/illuminants.js.map +1 -0
- package/dist/color/rgb-color-spaces.d.ts +79 -0
- package/dist/color/rgb-color-spaces.js +115 -0
- package/dist/color/rgb-color-spaces.js.map +1 -0
- package/dist/color/sensor-color-development.d.ts +33 -11
- package/dist/color/sensor-color-development.js +104 -30
- package/dist/color/sensor-color-development.js.map +1 -1
- package/dist/color/srgb-icc.d.ts +9 -2
- package/dist/color/srgb-icc.js +16 -5
- package/dist/color/srgb-icc.js.map +1 -1
- package/dist/color/srgb-transfer.d.ts +1 -2
- package/dist/color/srgb-transfer.js +1 -1
- package/dist/color/srgb-transfer.js.map +1 -1
- package/dist/color/white-balance.d.ts +68 -19
- package/dist/color/white-balance.js +168 -35
- package/dist/color/white-balance.js.map +1 -1
- package/dist/composition/image-formation-plan.d.ts +152 -128
- package/dist/composition/image-formation-plan.js +292 -138
- package/dist/composition/image-formation-plan.js.map +1 -1
- package/dist/composition/plan-consumer.d.ts +6 -7
- package/dist/composition/plan-consumer.js +14 -11
- package/dist/composition/plan-consumer.js.map +1 -1
- package/dist/core/calculation-result.d.ts +21 -14
- package/dist/core/calculation-result.js +209 -11
- package/dist/core/calculation-result.js.map +1 -1
- package/dist/core/canonical-json.d.ts +13 -8
- package/dist/core/canonical-json.js +34 -15
- package/dist/core/canonical-json.js.map +1 -1
- package/dist/core/configuration-error.d.ts +5 -4
- package/dist/core/configuration-error.js +5 -3
- package/dist/core/configuration-error.js.map +1 -1
- package/dist/core/evidence-provenance.d.ts +12 -12
- package/dist/core/evidence-provenance.js +10 -9
- package/dist/core/evidence-provenance.js.map +1 -1
- package/dist/core/image-formation.d.ts +11 -10
- package/dist/core/image-formation.js +11 -9
- package/dist/core/image-formation.js.map +1 -1
- package/dist/core/owned-data.d.ts +9 -17
- package/dist/core/owned-data.js +9 -16
- package/dist/core/owned-data.js.map +1 -1
- package/dist/core/portable-math.d.ts +15 -0
- package/dist/core/portable-math.js +56 -0
- package/dist/core/portable-math.js.map +1 -0
- package/dist/core/record-validation.d.ts +48 -9
- package/dist/core/record-validation.js +93 -19
- package/dist/core/record-validation.js.map +1 -1
- package/dist/core/scientific-assurance.d.ts +16 -14
- package/dist/core/scientific-assurance.js +22 -18
- package/dist/core/scientific-assurance.js.map +1 -1
- package/dist/core/spectral-composition.d.ts +13 -14
- package/dist/core/spectral-composition.js +30 -27
- package/dist/core/spectral-composition.js.map +1 -1
- package/dist/core/spectral.d.ts +5 -6
- package/dist/core/spectral.js +9 -7
- package/dist/core/spectral.js.map +1 -1
- package/dist/core/validation.d.ts +3 -6
- package/dist/core/validation.js +3 -5
- package/dist/core/validation.js.map +1 -1
- package/dist/core/version.d.ts +6 -6
- package/dist/core/version.js +6 -5
- package/dist/core/version.js.map +1 -1
- package/dist/equipment/exposure-capabilities.d.ts +10 -10
- package/dist/equipment/exposure-capabilities.js +40 -30
- package/dist/equipment/exposure-capabilities.js.map +1 -1
- package/dist/equipment/generic-tier-assets.d.ts +13 -6
- package/dist/equipment/generic-tier-assets.js +34 -15
- package/dist/equipment/generic-tier-assets.js.map +1 -1
- package/dist/equipment/generic-tier-presets.d.ts +5 -6
- package/dist/equipment/generic-tier-presets.js +15 -13
- package/dist/equipment/generic-tier-presets.js.map +1 -1
- package/dist/equipment/iso-capabilities.d.ts +21 -22
- package/dist/equipment/iso-capabilities.js +49 -44
- package/dist/equipment/iso-capabilities.js.map +1 -1
- package/dist/equipment/metering-capabilities.d.ts +5 -6
- package/dist/equipment/metering-capabilities.js +22 -19
- package/dist/equipment/metering-capabilities.js.map +1 -1
- package/dist/equipment/release-capabilities.d.ts +3 -4
- package/dist/equipment/release-capabilities.js +18 -14
- package/dist/equipment/release-capabilities.js.map +1 -1
- package/dist/exposure/exposure-duration-control.d.ts +19 -17
- package/dist/exposure/exposure-duration-control.js +27 -23
- package/dist/exposure/exposure-duration-control.js.map +1 -1
- package/dist/exposure/exposure-mode-resolver.d.ts +42 -39
- package/dist/exposure/exposure-mode-resolver.js +127 -82
- package/dist/exposure/exposure-mode-resolver.js.map +1 -1
- package/dist/exposure/exposure.d.ts +17 -16
- package/dist/exposure/exposure.js +22 -15
- package/dist/exposure/exposure.js.map +1 -1
- package/dist/exposure/flash-ttl.d.ts +135 -0
- package/dist/exposure/flash-ttl.js +193 -0
- package/dist/exposure/flash-ttl.js.map +1 -0
- package/dist/exposure/flash.d.ts +144 -36
- package/dist/exposure/flash.js +259 -59
- package/dist/exposure/flash.js.map +1 -1
- package/dist/exposure/metering-scene-radiance.d.ts +10 -10
- package/dist/exposure/metering-scene-radiance.js +42 -23
- package/dist/exposure/metering-scene-radiance.js.map +1 -1
- package/dist/exposure/metering-target.d.ts +8 -8
- package/dist/exposure/metering-target.js +30 -20
- package/dist/exposure/metering-target.js.map +1 -1
- package/dist/exposure/metering-temporal.d.ts +16 -15
- package/dist/exposure/metering-temporal.js +41 -19
- package/dist/exposure/metering-temporal.js.map +1 -1
- package/dist/exposure/metering.d.ts +64 -17
- package/dist/exposure/metering.js +159 -30
- package/dist/exposure/metering.js.map +1 -1
- package/dist/exposure/program-line.d.ts +5 -5
- package/dist/exposure/program-line.js +20 -13
- package/dist/exposure/program-line.js.map +1 -1
- package/dist/facade/camera-preset.d.ts +8 -0
- package/dist/facade/camera-preset.js +102 -0
- package/dist/facade/camera-preset.js.map +1 -0
- package/dist/facade/chart-radiance-batch.d.ts +57 -0
- package/dist/facade/chart-radiance-batch.js +121 -0
- package/dist/facade/chart-radiance-batch.js.map +1 -0
- package/dist/facade/chart-scenes.d.ts +177 -0
- package/dist/facade/chart-scenes.js +232 -0
- package/dist/facade/chart-scenes.js.map +1 -0
- package/dist/facade/diffraction-provider.d.ts +30 -0
- package/dist/facade/diffraction-provider.js +127 -0
- package/dist/facade/diffraction-provider.js.map +1 -0
- package/dist/facade/host-yield.d.ts +7 -0
- package/dist/facade/host-yield.js +19 -0
- package/dist/facade/host-yield.js.map +1 -0
- package/dist/facade/scene-radiance.d.ts +117 -0
- package/dist/facade/scene-radiance.js +205 -0
- package/dist/facade/scene-radiance.js.map +1 -0
- package/dist/facade/simulate-capture.d.ts +363 -0
- package/dist/facade/simulate-capture.js +1281 -0
- package/dist/facade/simulate-capture.js.map +1 -0
- package/dist/gpu/chart-radiance-gpu.d.ts +17 -0
- package/dist/gpu/chart-radiance-gpu.js +176 -0
- package/dist/gpu/chart-radiance-gpu.js.map +1 -0
- package/dist/gpu/image-kernel-accelerator.d.ts +132 -0
- package/dist/gpu/image-kernel-accelerator.js +720 -0
- package/dist/gpu/image-kernel-accelerator.js.map +1 -0
- package/dist/gpu/image-kernel-execution.d.ts +92 -0
- package/dist/gpu/image-kernel-execution.js +84 -0
- package/dist/gpu/image-kernel-execution.js.map +1 -0
- package/dist/gpu/sensor-stage-gpu.d.ts +44 -0
- package/dist/gpu/sensor-stage-gpu.js +317 -0
- package/dist/gpu/sensor-stage-gpu.js.map +1 -0
- package/dist/gpu/temporal-sum-gpu.d.ts +23 -0
- package/dist/gpu/temporal-sum-gpu.js +150 -0
- package/dist/gpu/temporal-sum-gpu.js.map +1 -0
- package/dist/gpu/webgpu-runtime.d.ts +63 -0
- package/dist/gpu/webgpu-runtime.js +215 -0
- package/dist/gpu/webgpu-runtime.js.map +1 -0
- package/dist/gpu/wgsl-chart-kernel.d.ts +30 -0
- package/dist/gpu/wgsl-chart-kernel.js +165 -0
- package/dist/gpu/wgsl-chart-kernel.js.map +1 -0
- package/dist/gpu/wgsl-kernels.d.ts +53 -0
- package/dist/gpu/wgsl-kernels.js +365 -0
- package/dist/gpu/wgsl-kernels.js.map +1 -0
- package/dist/gpu/wgsl-sensor-kernel.d.ts +64 -0
- package/dist/gpu/wgsl-sensor-kernel.js +409 -0
- package/dist/gpu/wgsl-sensor-kernel.js.map +1 -0
- package/dist/index.d.ts +91 -25
- package/dist/index.js +60 -15
- package/dist/index.js.map +1 -1
- package/dist/motion/camera-rotation.d.ts +92 -40
- package/dist/motion/camera-rotation.js +84 -47
- package/dist/motion/camera-rotation.js.map +1 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts +37 -34
- package/dist/motion/capture-rotation-inverse-mapping.js +32 -24
- package/dist/motion/capture-rotation-inverse-mapping.js.map +1 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts +39 -35
- package/dist/motion/capture-rotation-temporal-quadrature.js +37 -28
- package/dist/motion/capture-rotation-temporal-quadrature.js.map +1 -1
- package/dist/motion/capture-rotation-trajectory.d.ts +32 -28
- package/dist/motion/capture-rotation-trajectory.js +36 -26
- package/dist/motion/capture-rotation-trajectory.js.map +1 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts +23 -21
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js +33 -14
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js.map +1 -1
- package/dist/motion/extended-object-projection.d.ts +19 -16
- package/dist/motion/extended-object-projection.js +38 -18
- package/dist/motion/extended-object-projection.js.map +1 -1
- package/dist/motion/projected-motion.d.ts +18 -17
- package/dist/motion/projected-motion.js +25 -17
- package/dist/motion/projected-motion.js.map +1 -1
- package/dist/motion/temporal-exposure-sum.d.ts +55 -0
- package/dist/motion/temporal-exposure-sum.js +141 -0
- package/dist/motion/temporal-exposure-sum.js.map +1 -0
- package/dist/motion/video-sequence.d.ts +111 -0
- package/dist/motion/video-sequence.js +179 -0
- package/dist/motion/video-sequence.js.map +1 -0
- package/dist/optics/aperture.d.ts +14 -15
- package/dist/optics/aperture.js +13 -11
- package/dist/optics/aperture.js.map +1 -1
- package/dist/optics/atmospheric-haze.d.ts +83 -0
- package/dist/optics/atmospheric-haze.js +113 -0
- package/dist/optics/atmospheric-haze.js.map +1 -0
- package/dist/optics/brown-conrady-distortion.d.ts +116 -0
- package/dist/optics/brown-conrady-distortion.js +291 -0
- package/dist/optics/brown-conrady-distortion.js.map +1 -0
- package/dist/optics/circle-of-confusion.d.ts +10 -10
- package/dist/optics/circle-of-confusion.js +15 -11
- package/dist/optics/circle-of-confusion.js.map +1 -1
- package/dist/optics/complex-pupil-psf.d.ts +64 -33
- package/dist/optics/complex-pupil-psf.js +190 -98
- package/dist/optics/complex-pupil-psf.js.map +1 -1
- package/dist/optics/depth-of-field.d.ts +25 -15
- package/dist/optics/depth-of-field.js +67 -27
- package/dist/optics/depth-of-field.js.map +1 -1
- package/dist/optics/diffraction-psf-profile.d.ts +118 -0
- package/dist/optics/diffraction-psf-profile.js +252 -0
- package/dist/optics/diffraction-psf-profile.js.map +1 -0
- package/dist/optics/diffraction.d.ts +14 -13
- package/dist/optics/diffraction.js +14 -10
- package/dist/optics/diffraction.js.map +1 -1
- package/dist/optics/focus-breathing.d.ts +88 -27
- package/dist/optics/focus-breathing.js +114 -23
- package/dist/optics/focus-breathing.js.map +1 -1
- package/dist/optics/focus-state.d.ts +18 -18
- package/dist/optics/focus-state.js +21 -15
- package/dist/optics/focus-state.js.map +1 -1
- package/dist/optics/front-of-lens-filter.d.ts +45 -14
- package/dist/optics/front-of-lens-filter.js +259 -88
- package/dist/optics/front-of-lens-filter.js.map +1 -1
- package/dist/optics/illumination-vignetting.d.ts +16 -17
- package/dist/optics/illumination-vignetting.js +40 -17
- package/dist/optics/illumination-vignetting.js.map +1 -1
- package/dist/optics/irradiance-convolution.d.ts +59 -0
- package/dist/optics/irradiance-convolution.js +138 -0
- package/dist/optics/irradiance-convolution.js.map +1 -0
- package/dist/optics/lateral-chromatic-aberration.d.ts +33 -30
- package/dist/optics/lateral-chromatic-aberration.js +33 -23
- package/dist/optics/lateral-chromatic-aberration.js.map +1 -1
- package/dist/optics/lens-psf-kernels.d.ts +89 -0
- package/dist/optics/lens-psf-kernels.js +175 -0
- package/dist/optics/lens-psf-kernels.js.map +1 -0
- package/dist/optics/lens-psf-profile.d.ts +78 -46
- package/dist/optics/lens-psf-profile.js +335 -124
- package/dist/optics/lens-psf-profile.js.map +1 -1
- package/dist/optics/longitudinal-chromatic-aberration.d.ts +102 -0
- package/dist/optics/longitudinal-chromatic-aberration.js +210 -0
- package/dist/optics/longitudinal-chromatic-aberration.js.map +1 -0
- package/dist/optics/polygon-diffraction.d.ts +80 -23
- package/dist/optics/polygon-diffraction.js +130 -25
- package/dist/optics/polygon-diffraction.js.map +1 -1
- package/dist/optics/profile-contract.d.ts +5 -6
- package/dist/optics/profile-contract.js +14 -11
- package/dist/optics/profile-contract.js.map +1 -1
- package/dist/optics/psf-foundation.d.ts +23 -23
- package/dist/optics/psf-foundation.js +24 -21
- package/dist/optics/psf-foundation.js.map +1 -1
- package/dist/optics/pupil-vignetting.d.ts +118 -0
- package/dist/optics/pupil-vignetting.js +264 -0
- package/dist/optics/pupil-vignetting.js.map +1 -0
- package/dist/optics/radial-distortion.d.ts +34 -33
- package/dist/optics/radial-distortion.js +37 -30
- package/dist/optics/radial-distortion.js.map +1 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts +47 -33
- package/dist/optics/scene-to-sensor-irradiance.js +73 -45
- package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
- package/dist/optics/scene-to-sensor-quadrature.d.ts +23 -18
- package/dist/optics/scene-to-sensor-quadrature.js +16 -11
- package/dist/optics/scene-to-sensor-quadrature.js.map +1 -1
- package/dist/optics/sensor-aperture-rays.d.ts +20 -4
- package/dist/optics/sensor-aperture-rays.js +32 -14
- package/dist/optics/sensor-aperture-rays.js.map +1 -1
- package/dist/optics/sensor-environment-query.d.ts +81 -16
- package/dist/optics/sensor-environment-query.js +145 -12
- package/dist/optics/sensor-environment-query.js.map +1 -1
- package/dist/optics/sensor-psf-quadrature.d.ts +12 -10
- package/dist/optics/sensor-psf-quadrature.js +18 -11
- package/dist/optics/sensor-psf-quadrature.js.map +1 -1
- package/dist/optics/sensor-psf-support.d.ts +8 -6
- package/dist/optics/sensor-psf-support.js +8 -5
- package/dist/optics/sensor-psf-support.js.map +1 -1
- package/dist/optics/stray-light.d.ts +22 -19
- package/dist/optics/stray-light.js +18 -12
- package/dist/optics/stray-light.js.map +1 -1
- package/dist/optics/thin-lens.d.ts +10 -9
- package/dist/optics/thin-lens.js +12 -8
- package/dist/optics/thin-lens.js.map +1 -1
- package/dist/optics/zernike-wavefront.d.ts +154 -0
- package/dist/optics/zernike-wavefront.js +352 -0
- package/dist/optics/zernike-wavefront.js.map +1 -0
- package/dist/output/capture-corrected-sdr.d.ts +16 -8
- package/dist/output/capture-corrected-sdr.js +16 -8
- package/dist/output/capture-corrected-sdr.js.map +1 -1
- package/dist/output/capture-geometry.d.ts +34 -36
- package/dist/output/capture-geometry.js +52 -32
- package/dist/output/capture-geometry.js.map +1 -1
- package/dist/output/capture-sdr.d.ts +7 -6
- package/dist/output/capture-sdr.js +11 -8
- package/dist/output/capture-sdr.js.map +1 -1
- package/dist/output/crop.d.ts +22 -6
- package/dist/output/crop.js +40 -6
- package/dist/output/crop.js.map +1 -1
- package/dist/output/geometric-transforms.d.ts +60 -23
- package/dist/output/geometric-transforms.js +111 -24
- package/dist/output/geometric-transforms.js.map +1 -1
- package/dist/output/lens-corrections.d.ts +27 -19
- package/dist/output/lens-corrections.js +29 -13
- package/dist/output/lens-corrections.js.map +1 -1
- package/dist/output/native-capture-sdr.d.ts +71 -16
- package/dist/output/native-capture-sdr.js +190 -33
- package/dist/output/native-capture-sdr.js.map +1 -1
- package/dist/output/png-encoder.d.ts +65 -0
- package/dist/output/png-encoder.js +461 -0
- package/dist/output/png-encoder.js.map +1 -0
- package/dist/output/print-contrast-reference.d.ts +10 -9
- package/dist/output/print-contrast-reference.js +10 -8
- package/dist/output/print-contrast-reference.js.map +1 -1
- package/dist/output/print-detail.d.ts +18 -17
- package/dist/output/print-detail.js +12 -10
- package/dist/output/print-detail.js.map +1 -1
- package/dist/output/print-jpeg.d.ts +26 -5
- package/dist/output/print-jpeg.js +117 -50
- package/dist/output/print-jpeg.js.map +1 -1
- package/dist/output/print-plan.d.ts +19 -19
- package/dist/output/print-plan.js +11 -10
- package/dist/output/print-plan.js.map +1 -1
- package/dist/output/print-region-statistics.d.ts +14 -15
- package/dist/output/print-region-statistics.js +11 -11
- package/dist/output/print-region-statistics.js.map +1 -1
- package/dist/output/sdr-rendering.d.ts +48 -10
- package/dist/output/sdr-rendering.js +114 -25
- package/dist/output/sdr-rendering.js.map +1 -1
- package/dist/output/subject-framing-crop.d.ts +6 -10
- package/dist/output/subject-framing-crop.js +23 -13
- package/dist/output/subject-framing-crop.js.map +1 -1
- package/dist/processing/demosaic.d.ts +90 -0
- package/dist/processing/demosaic.js +275 -0
- package/dist/processing/demosaic.js.map +1 -0
- package/dist/processing/denoise.d.ts +68 -0
- package/dist/processing/denoise.js +214 -0
- package/dist/processing/denoise.js.map +1 -0
- package/dist/processing/focus-stacking.d.ts +17 -0
- package/dist/processing/focus-stacking.js +80 -0
- package/dist/processing/focus-stacking.js.map +1 -0
- package/dist/processing/hdr.d.ts +54 -0
- package/dist/processing/hdr.js +172 -0
- package/dist/processing/hdr.js.map +1 -0
- package/dist/processing/image-ops.d.ts +66 -0
- package/dist/processing/image-ops.js +192 -0
- package/dist/processing/image-ops.js.map +1 -0
- package/dist/processing/panorama.d.ts +51 -0
- package/dist/processing/panorama.js +305 -0
- package/dist/processing/panorama.js.map +1 -0
- package/dist/processing/processing-task.d.ts +85 -0
- package/dist/processing/processing-task.js +164 -0
- package/dist/processing/processing-task.js.map +1 -0
- package/dist/processing/tone-mapping.d.ts +69 -0
- package/dist/processing/tone-mapping.js +310 -0
- package/dist/processing/tone-mapping.js.map +1 -0
- package/dist/schema/camera.d.ts +5 -4
- package/dist/schema/illumination-spectral.d.ts +13 -19
- package/dist/schema/illumination-spectral.js +23 -19
- package/dist/schema/illumination-spectral.js.map +1 -1
- package/dist/schema/illumination-temporal.d.ts +12 -15
- package/dist/schema/illumination-temporal.js +43 -28
- package/dist/schema/illumination-temporal.js.map +1 -1
- package/dist/schema/illumination.d.ts +5 -4
- package/dist/schema/illumination.js +55 -20
- package/dist/schema/illumination.js.map +1 -1
- package/dist/schema/scene-radiance-temporal.d.ts +9 -11
- package/dist/schema/scene-radiance-temporal.js +26 -23
- package/dist/schema/scene-radiance-temporal.js.map +1 -1
- package/dist/schema/scene-radiance.d.ts +17 -17
- package/dist/schema/scene-radiance.js +56 -34
- package/dist/schema/scene-radiance.js.map +1 -1
- package/dist/schema/scene.d.ts +14 -13
- package/dist/schema/validation.d.ts +0 -1
- package/dist/schema/validation.js +17 -15
- package/dist/schema/validation.js.map +1 -1
- package/dist/sensor/accumulated-charge.d.ts +45 -64
- package/dist/sensor/accumulated-charge.js +41 -47
- package/dist/sensor/accumulated-charge.js.map +1 -1
- package/dist/sensor/architecture.d.ts +22 -25
- package/dist/sensor/architecture.js +17 -16
- package/dist/sensor/architecture.js.map +1 -1
- package/dist/sensor/camera-saturation-capacity.d.ts +21 -28
- package/dist/sensor/camera-saturation-capacity.js +36 -34
- package/dist/sensor/camera-saturation-capacity.js.map +1 -1
- package/dist/sensor/capture-color-sampling-binding.d.ts +46 -51
- package/dist/sensor/capture-color-sampling-binding.js +39 -41
- package/dist/sensor/capture-color-sampling-binding.js.map +1 -1
- package/dist/sensor/capture-mode-timing.d.ts +8 -9
- package/dist/sensor/capture-mode-timing.js +24 -21
- package/dist/sensor/capture-mode-timing.js.map +1 -1
- package/dist/sensor/capture-mode.d.ts +28 -30
- package/dist/sensor/capture-mode.js +33 -31
- package/dist/sensor/capture-mode.js.map +1 -1
- package/dist/sensor/color-sampling.d.ts +30 -33
- package/dist/sensor/color-sampling.js +32 -37
- package/dist/sensor/color-sampling.js.map +1 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts +19 -23
- package/dist/sensor/constant-rate-temporal-integration.js +28 -26
- package/dist/sensor/constant-rate-temporal-integration.js.map +1 -1
- package/dist/sensor/dark-current.d.ts +53 -49
- package/dist/sensor/dark-current.js +87 -46
- package/dist/sensor/dark-current.js.map +1 -1
- package/dist/sensor/environment-photo-signal.d.ts +71 -30
- package/dist/sensor/environment-photo-signal.js +127 -46
- package/dist/sensor/environment-photo-signal.js.map +1 -1
- package/dist/sensor/eqe-electron-rate.d.ts +14 -13
- package/dist/sensor/eqe-electron-rate.js +34 -14
- package/dist/sensor/eqe-electron-rate.js.map +1 -1
- package/dist/sensor/eqe-local-exposure.d.ts +24 -24
- package/dist/sensor/eqe-local-exposure.js +15 -11
- package/dist/sensor/eqe-local-exposure.js.map +1 -1
- package/dist/sensor/eqe-temporal-exposure.d.ts +11 -11
- package/dist/sensor/eqe-temporal-exposure.js +15 -10
- package/dist/sensor/eqe-temporal-exposure.js.map +1 -1
- package/dist/sensor/exposure-window.d.ts +48 -34
- package/dist/sensor/exposure-window.js +77 -36
- package/dist/sensor/exposure-window.js.map +1 -1
- package/dist/sensor/fixed-pattern-noise.d.ts +108 -0
- package/dist/sensor/fixed-pattern-noise.js +166 -0
- package/dist/sensor/fixed-pattern-noise.js.map +1 -0
- package/dist/sensor/iso-gain.d.ts +44 -0
- package/dist/sensor/iso-gain.js +119 -0
- package/dist/sensor/iso-gain.js.map +1 -0
- package/dist/sensor/iso-signal-chain.d.ts +25 -48
- package/dist/sensor/iso-signal-chain.js +52 -66
- package/dist/sensor/iso-signal-chain.js.map +1 -1
- package/dist/sensor/local-exposure-binding.d.ts +21 -21
- package/dist/sensor/local-exposure-binding.js +22 -18
- package/dist/sensor/local-exposure-binding.js.map +1 -1
- package/dist/sensor/optical-stack.d.ts +36 -40
- package/dist/sensor/optical-stack.js +34 -37
- package/dist/sensor/optical-stack.js.map +1 -1
- package/dist/sensor/photon-energy.d.ts +22 -28
- package/dist/sensor/photon-energy.js +42 -34
- package/dist/sensor/photon-energy.js.map +1 -1
- package/dist/sensor/physical-charge-capacity.d.ts +20 -30
- package/dist/sensor/physical-charge-capacity.js +35 -36
- package/dist/sensor/physical-charge-capacity.js.map +1 -1
- package/dist/sensor/pixel-pitch.d.ts +2 -3
- package/dist/sensor/pixel-pitch.js +4 -2
- package/dist/sensor/pixel-pitch.js.map +1 -1
- package/dist/sensor/radiometry-readiness.d.ts +13 -15
- package/dist/sensor/radiometry-readiness.js +20 -17
- package/dist/sensor/radiometry-readiness.js.map +1 -1
- package/dist/sensor/raw-readout.d.ts +173 -83
- package/dist/sensor/raw-readout.js +425 -160
- package/dist/sensor/raw-readout.js.map +1 -1
- package/dist/sensor/raw-reconstruction.d.ts +112 -44
- package/dist/sensor/raw-reconstruction.js +200 -47
- package/dist/sensor/raw-reconstruction.js.map +1 -1
- package/dist/sensor/readout-exposure-linkage.d.ts +103 -34
- package/dist/sensor/readout-exposure-linkage.js +125 -27
- package/dist/sensor/readout-exposure-linkage.js.map +1 -1
- package/dist/sensor/readout-timing.d.ts +43 -44
- package/dist/sensor/readout-timing.js +38 -30
- package/dist/sensor/readout-timing.js.map +1 -1
- package/dist/sensor/response-application-compatibility.d.ts +21 -28
- package/dist/sensor/response-application-compatibility.js +35 -34
- package/dist/sensor/response-application-compatibility.js.map +1 -1
- package/dist/sensor/response-operating-range.d.ts +26 -35
- package/dist/sensor/response-operating-range.js +40 -39
- package/dist/sensor/response-operating-range.js.map +1 -1
- package/dist/sensor/responsivity-photocurrent.d.ts +21 -29
- package/dist/sensor/responsivity-photocurrent.js +57 -40
- package/dist/sensor/responsivity-photocurrent.js.map +1 -1
- package/dist/sensor/sampling-aperture.d.ts +21 -25
- package/dist/sensor/sampling-aperture.js +29 -28
- package/dist/sensor/sampling-aperture.js.map +1 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts +14 -12
- package/dist/sensor/scene-eqe-temporal-exposure.js +13 -8
- package/dist/sensor/scene-eqe-temporal-exposure.js.map +1 -1
- package/dist/sensor/sensor-geometry.d.ts +28 -32
- package/dist/sensor/sensor-geometry.js +35 -20
- package/dist/sensor/sensor-geometry.js.map +1 -1
- package/dist/sensor/signal-noise.d.ts +14 -16
- package/dist/sensor/signal-noise.js +15 -13
- package/dist/sensor/signal-noise.js.map +1 -1
- package/dist/sensor/spatial-sample-reduction.d.ts +45 -60
- package/dist/sensor/spatial-sample-reduction.js +39 -48
- package/dist/sensor/spatial-sample-reduction.js.map +1 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts +46 -54
- package/dist/sensor/spatial-sampling-quadrature.js +31 -36
- package/dist/sensor/spatial-sampling-quadrature.js.map +1 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts +32 -42
- package/dist/sensor/spatio-spectral-reduction.js +24 -29
- package/dist/sensor/spatio-spectral-reduction.js.map +1 -1
- package/dist/sensor/spectral-coverage.d.ts +6 -9
- package/dist/sensor/spectral-coverage.js +9 -6
- package/dist/sensor/spectral-coverage.js.map +1 -1
- package/dist/sensor/spectral-quadrature.d.ts +46 -60
- package/dist/sensor/spectral-quadrature.js +38 -48
- package/dist/sensor/spectral-quadrature.js.map +1 -1
- package/dist/sensor/spectral-response.d.ts +53 -41
- package/dist/sensor/spectral-response.js +80 -47
- package/dist/sensor/spectral-response.js.map +1 -1
- package/dist/sensor/stochastic-seed.d.ts +50 -0
- package/dist/sensor/stochastic-seed.js +123 -0
- package/dist/sensor/stochastic-seed.js.map +1 -0
- package/dist/sensor/temporal-eqe-sum.d.ts +2 -4
- package/dist/sensor/temporal-eqe-sum.js +5 -6
- package/dist/sensor/temporal-eqe-sum.js.map +1 -1
- package/dist/sensor/temporal-photo-signal.d.ts +5 -6
- package/dist/sensor/temporal-photo-signal.js +11 -10
- package/dist/sensor/temporal-photo-signal.js.map +1 -1
- package/dist/sensor/temporal-sample-binding.d.ts +1 -2
- package/dist/sensor/temporal-sample-binding.js +3 -3
- package/dist/sensor/temporal-sample-binding.js.map +1 -1
- package/dist/simulation/poc-simulation.d.ts +16 -16
- package/dist/simulation/poc-simulation.js +20 -15
- package/dist/simulation/poc-simulation.js.map +1 -1
- package/dist/stabilization/camera-shake.d.ts +42 -18
- package/dist/stabilization/camera-shake.js +43 -20
- package/dist/stabilization/camera-shake.js.map +1 -1
- package/dist/stabilization/system.d.ts +44 -41
- package/dist/stabilization/system.js +196 -108
- package/dist/stabilization/system.js.map +1 -1
- package/docs/AGENT_GUIDE.md +183 -0
- package/docs/API_REFERENCE.md +777 -2
- package/docs/QUICK_START.md +663 -0
- package/docs/USAGE.md +1719 -714
- package/docs/api/camera-equivalent-focal-length.md +6 -7
- package/docs/api/camera-field-of-view.md +16 -8
- package/docs/api/camera-lens-projection.md +246 -0
- package/docs/api/camera-projected-object-size.md +6 -5
- package/docs/api/capture-capture-export-metadata.md +10 -10
- package/docs/api/capture-dng-import.md +134 -0
- package/docs/api/capture-environment-raw-producer.md +17 -11
- package/docs/api/capture-export-jpeg.md +16 -0
- package/docs/api/capture-focus-control.md +25 -47
- package/docs/api/capture-linear-encoding.md +21 -12
- package/docs/api/capture-lossless-jpeg.md +49 -0
- package/docs/api/capture-native-environment-optical-stage.md +75 -0
- package/docs/api/capture-native-environment-raw.md +161 -4
- package/docs/api/capture-native-raw-development.md +69 -8
- package/docs/api/capture-native-raw-dng.md +84 -0
- package/docs/api/capture-native-raw.md +21 -10
- package/docs/api/capture-packed-sensor-raw.md +156 -0
- package/docs/api/capture-photographic-export.md +69 -31
- package/docs/api/capture-raw-frame-reconstruction.md +8 -8
- package/docs/api/capture-raw-white-level.md +37 -0
- package/docs/api/capture-release-sequence.md +6 -7
- package/docs/api/capture-sensor-raw-frame.md +6 -6
- package/docs/api/capture-sensor-raw-producer.md +17 -11
- package/docs/api/capture-simulated-capture.md +15 -15
- package/docs/api/color-camera-color-matrix.md +103 -0
- package/docs/api/color-capture-color.md +22 -11
- package/docs/api/color-chromatic-adaptation.md +82 -0
- package/docs/api/color-color-difference.md +134 -0
- package/docs/api/color-color-matching-functions.md +259 -0
- package/docs/api/color-colorimetry-math.md +54 -0
- package/docs/api/color-gamut-mapping.md +72 -0
- package/docs/api/color-illuminants.md +280 -0
- package/docs/api/color-rgb-color-spaces.md +151 -0
- package/docs/api/color-sensor-color-development.md +27 -0
- package/docs/api/color-srgb-icc.md +2 -4
- package/docs/api/color-white-balance.md +95 -19
- package/docs/api/composition-image-formation-plan.md +124 -95
- package/docs/api/composition-plan-consumer.md +7 -7
- package/docs/api/core-calculation-result.md +18 -14
- package/docs/api/core-configuration-error.md +1 -1
- package/docs/api/core-image-formation.md +7 -7
- package/docs/api/core-scientific-assurance.md +12 -10
- package/docs/api/core-spectral-composition.md +14 -14
- package/docs/api/core-spectral.md +6 -6
- package/docs/api/core-validation.md +3 -3
- package/docs/api/core-version.md +7 -6
- package/docs/api/equipment-exposure-capabilities.md +11 -10
- package/docs/api/equipment-generic-tier-assets.md +7 -2
- package/docs/api/equipment-generic-tier-presets.md +6 -6
- package/docs/api/equipment-iso-capabilities.md +18 -18
- package/docs/api/equipment-metering-capabilities.md +6 -6
- package/docs/api/equipment-release-capabilities.md +4 -4
- package/docs/api/exports.json +2253 -3
- package/docs/api/exposure-exposure-duration-control.md +9 -9
- package/docs/api/exposure-exposure-mode-resolver.md +35 -31
- package/docs/api/exposure-exposure.md +10 -10
- package/docs/api/exposure-flash-ttl.md +182 -0
- package/docs/api/exposure-flash.md +183 -28
- package/docs/api/exposure-metering-scene-radiance.md +11 -10
- package/docs/api/exposure-metering-target.md +9 -8
- package/docs/api/exposure-metering-temporal.md +8 -8
- package/docs/api/exposure-metering.md +69 -9
- package/docs/api/exposure-program-line.md +6 -5
- package/docs/api/facade-chart-radiance-batch.md +96 -0
- package/docs/api/facade-chart-scenes.md +240 -0
- package/docs/api/facade-scene-radiance.md +122 -0
- package/docs/api/facade-simulate-capture.md +397 -0
- package/docs/api/gpu-image-kernel-accelerator.md +157 -0
- package/docs/api/gpu-image-kernel-execution.md +152 -0
- package/docs/api/motion-camera-rotation.md +43 -26
- package/docs/api/motion-capture-rotation-inverse-mapping.md +24 -23
- package/docs/api/motion-capture-rotation-temporal-quadrature.md +22 -22
- package/docs/api/motion-capture-rotation-trajectory.md +15 -15
- package/docs/api/motion-capture-translation-parallax-temporal-quadrature.md +15 -14
- package/docs/api/motion-extended-object-projection.md +10 -8
- package/docs/api/motion-projected-motion.md +8 -8
- package/docs/api/motion-temporal-exposure-sum.md +98 -0
- package/docs/api/motion-video-sequence.md +159 -0
- package/docs/api/optics-aperture.md +8 -8
- package/docs/api/optics-atmospheric-haze.md +104 -0
- package/docs/api/optics-brown-conrady-distortion.md +123 -0
- package/docs/api/optics-circle-of-confusion.md +5 -4
- package/docs/api/optics-complex-pupil-psf.md +57 -16
- package/docs/api/optics-depth-of-field.md +12 -6
- package/docs/api/optics-diffraction-psf-profile.md +96 -0
- package/docs/api/optics-diffraction.md +8 -7
- package/docs/api/optics-focus-breathing.md +104 -16
- package/docs/api/optics-focus-state.md +9 -10
- package/docs/api/optics-front-of-lens-filter.md +72 -14
- package/docs/api/optics-illumination-vignetting.md +10 -10
- package/docs/api/optics-irradiance-convolution.md +95 -0
- package/docs/api/optics-lateral-chromatic-aberration.md +22 -21
- package/docs/api/optics-lens-psf-kernels.md +72 -0
- package/docs/api/optics-lens-psf-profile.md +48 -26
- package/docs/api/optics-longitudinal-chromatic-aberration.md +128 -0
- package/docs/api/optics-polygon-diffraction.md +78 -13
- package/docs/api/optics-profile-contract.md +4 -4
- package/docs/api/optics-psf-foundation.md +12 -12
- package/docs/api/optics-pupil-vignetting.md +132 -0
- package/docs/api/optics-radial-distortion.md +12 -12
- package/docs/api/optics-scene-to-sensor-irradiance.md +25 -14
- package/docs/api/optics-scene-to-sensor-quadrature.md +15 -12
- package/docs/api/optics-sensor-aperture-rays.md +3 -2
- package/docs/api/optics-sensor-environment-query.md +52 -9
- package/docs/api/optics-sensor-psf-quadrature.md +13 -10
- package/docs/api/optics-stray-light.md +12 -11
- package/docs/api/optics-thin-lens.md +4 -3
- package/docs/api/optics-zernike-wavefront.md +229 -0
- package/docs/api/output-capture-corrected-sdr.md +10 -7
- package/docs/api/output-capture-geometry.md +35 -36
- package/docs/api/output-capture-sdr.md +4 -4
- package/docs/api/output-crop.md +7 -4
- package/docs/api/output-geometric-transforms.md +65 -19
- package/docs/api/output-lens-corrections.md +17 -15
- package/docs/api/output-native-capture-sdr.md +26 -13
- package/docs/api/output-png-encoder.md +105 -0
- package/docs/api/output-print-contrast-reference.md +8 -8
- package/docs/api/output-print-detail.md +14 -14
- package/docs/api/output-print-jpeg.md +22 -5
- package/docs/api/output-print-plan.md +18 -18
- package/docs/api/output-print-region-statistics.md +14 -14
- package/docs/api/output-sdr-rendering.md +52 -10
- package/docs/api/output-subject-framing-crop.md +5 -6
- package/docs/api/processing-demosaic.md +120 -0
- package/docs/api/processing-denoise.md +148 -0
- package/docs/api/processing-focus-stacking.md +41 -0
- package/docs/api/processing-hdr.md +113 -0
- package/docs/api/processing-panorama.md +82 -0
- package/docs/api/processing-processing-task.md +107 -0
- package/docs/api/processing-tone-mapping.md +142 -0
- package/docs/api/schema-camera.md +6 -4
- package/docs/api/schema-illumination-spectral.md +10 -11
- package/docs/api/schema-illumination-temporal.md +13 -15
- package/docs/api/schema-illumination.md +4 -4
- package/docs/api/schema-scene-radiance-temporal.md +10 -11
- package/docs/api/schema-scene-radiance.md +18 -17
- package/docs/api/schema-scene.md +9 -9
- package/docs/api/schema-validation.md +1 -1
- package/docs/api/sensor-accumulated-charge.md +12 -20
- package/docs/api/sensor-architecture.md +15 -16
- package/docs/api/sensor-camera-saturation-capacity.md +9 -11
- package/docs/api/sensor-capture-color-sampling-binding.md +47 -51
- package/docs/api/sensor-capture-mode-timing.md +9 -9
- package/docs/api/sensor-capture-mode.md +29 -30
- package/docs/api/sensor-color-sampling.md +31 -33
- package/docs/api/sensor-constant-rate-temporal-integration.md +10 -11
- package/docs/api/sensor-dark-current.md +30 -14
- package/docs/api/sensor-environment-photo-signal.md +13 -6
- package/docs/api/sensor-eqe-electron-rate.md +9 -8
- package/docs/api/sensor-eqe-local-exposure.md +18 -17
- package/docs/api/sensor-eqe-temporal-exposure.md +12 -11
- package/docs/api/sensor-exposure-window.md +24 -24
- package/docs/api/sensor-fixed-pattern-noise.md +104 -0
- package/docs/api/sensor-iso-gain.md +63 -0
- package/docs/api/sensor-iso-signal-chain.md +13 -22
- package/docs/api/sensor-local-exposure-binding.md +12 -13
- package/docs/api/sensor-optical-stack.md +37 -40
- package/docs/api/sensor-photon-energy.md +10 -11
- package/docs/api/sensor-physical-charge-capacity.md +8 -13
- package/docs/api/sensor-pixel-pitch.md +1 -1
- package/docs/api/sensor-radiometry-readiness.md +9 -9
- package/docs/api/sensor-raw-readout.md +118 -52
- package/docs/api/sensor-raw-reconstruction.md +97 -20
- package/docs/api/sensor-readout-exposure-linkage.md +120 -24
- package/docs/api/sensor-readout-timing.md +33 -35
- package/docs/api/sensor-response-application-compatibility.md +9 -11
- package/docs/api/sensor-response-operating-range.md +14 -18
- package/docs/api/sensor-responsivity-photocurrent.md +9 -12
- package/docs/api/sensor-sampling-aperture.md +22 -25
- package/docs/api/sensor-scene-eqe-temporal-exposure.md +9 -8
- package/docs/api/sensor-sensor-geometry.md +23 -24
- package/docs/api/sensor-signal-noise.md +10 -10
- package/docs/api/sensor-spatial-sample-reduction.md +27 -30
- package/docs/api/sensor-spatial-sampling-quadrature.md +37 -39
- package/docs/api/sensor-spatio-spectral-reduction.md +27 -29
- package/docs/api/sensor-spectral-coverage.md +5 -5
- package/docs/api/sensor-spectral-quadrature.md +33 -35
- package/docs/api/sensor-spectral-response.md +28 -16
- package/docs/api/sensor-temporal-photo-signal.md +6 -6
- package/docs/api/simulation-poc-simulation.md +17 -16
- package/docs/api/stabilization-camera-shake.md +29 -10
- package/docs/api/stabilization-system.md +25 -21
- package/docs/examples/production-request.json +3821 -2157
- package/docs/examples/simulate-capture.mjs +14 -0
- package/llms.txt +35 -0
- package/package.json +32 -11
- package/AGENTS.md +0 -674
- package/CONTRIBUTING.md +0 -76
- package/DCO +0 -33
- package/dist/camera/equivalent-focal-length.d.ts.map +0 -1
- package/dist/camera/field-of-view.d.ts.map +0 -1
- package/dist/camera/projected-object-size.d.ts.map +0 -1
- package/dist/capture/capture-export-metadata.d.ts.map +0 -1
- package/dist/capture/environment-raw-producer.d.ts.map +0 -1
- package/dist/capture/export-jpeg.d.ts.map +0 -1
- package/dist/capture/export-tiff.d.ts.map +0 -1
- package/dist/capture/focus-control.d.ts.map +0 -1
- package/dist/capture/linear-encoding.d.ts.map +0 -1
- package/dist/capture/native-environment-raw.d.ts.map +0 -1
- package/dist/capture/native-raw-development.d.ts.map +0 -1
- package/dist/capture/native-raw.d.ts.map +0 -1
- package/dist/capture/photographic-export.d.ts.map +0 -1
- package/dist/capture/raw-frame-limits.d.ts.map +0 -1
- package/dist/capture/raw-frame-reconstruction.d.ts.map +0 -1
- package/dist/capture/release-sequence.d.ts.map +0 -1
- package/dist/capture/sensor-raw-frame.d.ts.map +0 -1
- package/dist/capture/sensor-raw-producer.d.ts.map +0 -1
- package/dist/capture/simulated-capture.d.ts.map +0 -1
- package/dist/color/capture-color.d.ts.map +0 -1
- package/dist/color/sensor-color-development.d.ts.map +0 -1
- package/dist/color/srgb-icc.d.ts.map +0 -1
- package/dist/color/srgb-transfer.d.ts.map +0 -1
- package/dist/color/white-balance.d.ts.map +0 -1
- package/dist/composition/image-formation-plan.d.ts.map +0 -1
- package/dist/composition/plan-consumer.d.ts.map +0 -1
- package/dist/core/calculation-result.d.ts.map +0 -1
- package/dist/core/canonical-json.d.ts.map +0 -1
- package/dist/core/configuration-error.d.ts.map +0 -1
- package/dist/core/evidence-provenance.d.ts.map +0 -1
- package/dist/core/image-formation.d.ts.map +0 -1
- package/dist/core/owned-data.d.ts.map +0 -1
- package/dist/core/record-validation.d.ts.map +0 -1
- package/dist/core/scientific-assurance.d.ts.map +0 -1
- package/dist/core/spectral-composition.d.ts.map +0 -1
- package/dist/core/spectral.d.ts.map +0 -1
- package/dist/core/validation.d.ts.map +0 -1
- package/dist/core/version.d.ts.map +0 -1
- package/dist/equipment/exposure-capabilities.d.ts.map +0 -1
- package/dist/equipment/generic-tier-assets.d.ts.map +0 -1
- package/dist/equipment/generic-tier-presets.d.ts.map +0 -1
- package/dist/equipment/iso-capabilities.d.ts.map +0 -1
- package/dist/equipment/metering-capabilities.d.ts.map +0 -1
- package/dist/equipment/release-capabilities.d.ts.map +0 -1
- package/dist/exposure/exposure-duration-control.d.ts.map +0 -1
- package/dist/exposure/exposure-mode-resolver.d.ts.map +0 -1
- package/dist/exposure/exposure.d.ts.map +0 -1
- package/dist/exposure/flash.d.ts.map +0 -1
- package/dist/exposure/metering-scene-radiance.d.ts.map +0 -1
- package/dist/exposure/metering-target.d.ts.map +0 -1
- package/dist/exposure/metering-temporal.d.ts.map +0 -1
- package/dist/exposure/metering.d.ts.map +0 -1
- package/dist/exposure/program-line.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/motion/camera-rotation.d.ts.map +0 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts.map +0 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts.map +0 -1
- package/dist/motion/capture-rotation-trajectory.d.ts.map +0 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts.map +0 -1
- package/dist/motion/extended-object-projection.d.ts.map +0 -1
- package/dist/motion/projected-motion.d.ts.map +0 -1
- package/dist/optics/aperture.d.ts.map +0 -1
- package/dist/optics/circle-of-confusion.d.ts.map +0 -1
- package/dist/optics/complex-pupil-psf.d.ts.map +0 -1
- package/dist/optics/depth-of-field.d.ts.map +0 -1
- package/dist/optics/diffraction.d.ts.map +0 -1
- package/dist/optics/focus-breathing.d.ts.map +0 -1
- package/dist/optics/focus-state.d.ts.map +0 -1
- package/dist/optics/front-of-lens-filter.d.ts.map +0 -1
- package/dist/optics/illumination-vignetting.d.ts.map +0 -1
- package/dist/optics/lateral-chromatic-aberration.d.ts.map +0 -1
- package/dist/optics/lens-psf-profile.d.ts.map +0 -1
- package/dist/optics/polygon-diffraction.d.ts.map +0 -1
- package/dist/optics/profile-contract.d.ts.map +0 -1
- package/dist/optics/psf-foundation.d.ts.map +0 -1
- package/dist/optics/radial-distortion.d.ts.map +0 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts.map +0 -1
- package/dist/optics/scene-to-sensor-quadrature.d.ts.map +0 -1
- package/dist/optics/sensor-aperture-rays.d.ts.map +0 -1
- package/dist/optics/sensor-environment-query.d.ts.map +0 -1
- package/dist/optics/sensor-psf-quadrature.d.ts.map +0 -1
- package/dist/optics/sensor-psf-support.d.ts.map +0 -1
- package/dist/optics/stray-light.d.ts.map +0 -1
- package/dist/optics/thin-lens.d.ts.map +0 -1
- package/dist/output/capture-corrected-sdr.d.ts.map +0 -1
- package/dist/output/capture-geometry.d.ts.map +0 -1
- package/dist/output/capture-sdr.d.ts.map +0 -1
- package/dist/output/crop.d.ts.map +0 -1
- package/dist/output/geometric-transforms.d.ts.map +0 -1
- package/dist/output/lens-corrections.d.ts.map +0 -1
- package/dist/output/native-capture-sdr.d.ts.map +0 -1
- package/dist/output/print-contrast-reference.d.ts.map +0 -1
- package/dist/output/print-detail.d.ts.map +0 -1
- package/dist/output/print-jpeg.d.ts.map +0 -1
- package/dist/output/print-plan.d.ts.map +0 -1
- package/dist/output/print-region-statistics.d.ts.map +0 -1
- package/dist/output/sdr-rendering.d.ts.map +0 -1
- package/dist/output/subject-framing-crop.d.ts.map +0 -1
- package/dist/schema/camera.d.ts.map +0 -1
- package/dist/schema/camera.js +0 -3
- package/dist/schema/camera.js.map +0 -1
- package/dist/schema/illumination-spectral.d.ts.map +0 -1
- package/dist/schema/illumination-temporal.d.ts.map +0 -1
- package/dist/schema/illumination.d.ts.map +0 -1
- package/dist/schema/scene-radiance-temporal.d.ts.map +0 -1
- package/dist/schema/scene-radiance.d.ts.map +0 -1
- package/dist/schema/scene.d.ts.map +0 -1
- package/dist/schema/scene.js +0 -3
- package/dist/schema/scene.js.map +0 -1
- package/dist/schema/validation.d.ts.map +0 -1
- package/dist/sensor/accumulated-charge.d.ts.map +0 -1
- package/dist/sensor/architecture.d.ts.map +0 -1
- package/dist/sensor/camera-saturation-capacity.d.ts.map +0 -1
- package/dist/sensor/capture-color-sampling-binding.d.ts.map +0 -1
- package/dist/sensor/capture-mode-timing.d.ts.map +0 -1
- package/dist/sensor/capture-mode.d.ts.map +0 -1
- package/dist/sensor/color-sampling.d.ts.map +0 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts.map +0 -1
- package/dist/sensor/dark-current.d.ts.map +0 -1
- package/dist/sensor/environment-photo-signal.d.ts.map +0 -1
- package/dist/sensor/eqe-electron-rate.d.ts.map +0 -1
- package/dist/sensor/eqe-local-exposure.d.ts.map +0 -1
- package/dist/sensor/eqe-temporal-exposure.d.ts.map +0 -1
- package/dist/sensor/exposure-window.d.ts.map +0 -1
- package/dist/sensor/iso-signal-chain.d.ts.map +0 -1
- package/dist/sensor/local-exposure-binding.d.ts.map +0 -1
- package/dist/sensor/optical-stack.d.ts.map +0 -1
- package/dist/sensor/photon-energy.d.ts.map +0 -1
- package/dist/sensor/physical-charge-capacity.d.ts.map +0 -1
- package/dist/sensor/pixel-pitch.d.ts.map +0 -1
- package/dist/sensor/radiometry-readiness.d.ts.map +0 -1
- package/dist/sensor/raw-readout.d.ts.map +0 -1
- package/dist/sensor/raw-reconstruction.d.ts.map +0 -1
- package/dist/sensor/readout-exposure-linkage.d.ts.map +0 -1
- package/dist/sensor/readout-timing.d.ts.map +0 -1
- package/dist/sensor/response-application-compatibility.d.ts.map +0 -1
- package/dist/sensor/response-operating-range.d.ts.map +0 -1
- package/dist/sensor/responsivity-photocurrent.d.ts.map +0 -1
- package/dist/sensor/sampling-aperture.d.ts.map +0 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts.map +0 -1
- package/dist/sensor/sensor-geometry.d.ts.map +0 -1
- package/dist/sensor/signal-noise.d.ts.map +0 -1
- package/dist/sensor/spatial-sample-reduction.d.ts.map +0 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts.map +0 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts.map +0 -1
- package/dist/sensor/spectral-coverage.d.ts.map +0 -1
- package/dist/sensor/spectral-quadrature.d.ts.map +0 -1
- package/dist/sensor/spectral-response.d.ts.map +0 -1
- package/dist/sensor/temporal-eqe-sum.d.ts.map +0 -1
- package/dist/sensor/temporal-photo-signal.d.ts.map +0 -1
- package/dist/sensor/temporal-sample-binding.d.ts.map +0 -1
- package/dist/simulation/poc-simulation.d.ts.map +0 -1
- package/dist/stabilization/camera-shake.d.ts.map +0 -1
- package/dist/stabilization/system.d.ts.map +0 -1
- package/docs/API_STYLE.md +0 -235
- package/docs/ARCHITECTURE.md +0 -356
- package/docs/AUTOMATION_COORDINATION.md +0 -190
- package/docs/CAPTURE_COLOR.md +0 -25
- package/docs/CAPTURE_CORRECTED_SDR.md +0 -25
- package/docs/CAPTURE_EXPORT_METADATA.md +0 -27
- package/docs/CAPTURE_SDR.md +0 -22
- package/docs/DENSE_PUPIL_QUALIFICATION.md +0 -121
- package/docs/DEVELOPERS.md +0 -68
- package/docs/DIGITAL_OPTICS_FOUNDATION.md +0 -69
- package/docs/ENVIRONMENT_RAW_CAPTURE.md +0 -208
- package/docs/EXPORT_ACCEPTANCE.md +0 -133
- package/docs/GENERIC_TIER_PRESETS.md +0 -269
- package/docs/GEOMETRIC_PREPARATION_REUSE.md +0 -141
- package/docs/IMAGE_FORMATION.md +0 -247
- package/docs/LINEAR_CAPTURE_ENCODING.md +0 -25
- package/docs/MOTION_AND_SIGNAL.md +0 -250
- package/docs/NATIVE_CAPTURE_SDR.md +0 -70
- package/docs/NATIVE_CAPTURE_SDR_REVIEW.md +0 -37
- package/docs/NATIVE_CAPTURE_SDR_VALIDATION.md +0 -34
- package/docs/NATIVE_RAW_AND_PRINT.md +0 -54
- package/docs/NUMERICAL_CORRECTNESS.md +0 -191
- package/docs/PERFORMANCE_BASELINE.md +0 -56
- package/docs/PHOTOGRAPHIC_EXPORT.md +0 -206
- package/docs/PHYSICS_FOUNDATION.md +0 -426
- package/docs/POC_API.md +0 -278
- package/docs/POC_PROJECTION_PLATFORM_REFERENCE.md +0 -12
- package/docs/POC_PROJECTION_REUSE.md +0 -124
- package/docs/PRINT_195_196_REVIEW.md +0 -93
- package/docs/PRINT_196_ENGINE_ACCEPTANCE.md +0 -45
- package/docs/PRINT_CONTRAST_REFERENCE.md +0 -43
- package/docs/PRINT_DETAIL_ASSESSMENT.md +0 -81
- package/docs/PRINT_DETAIL_JPEG_EVIDENCE.md +0 -36
- package/docs/PRINT_DETAIL_SDR_EVIDENCE.md +0 -29
- package/docs/PRINT_DETAIL_VALIDATION.md +0 -36
- package/docs/PRINT_PLANNING.md +0 -75
- package/docs/PRINT_REGION_STATISTICS.md +0 -38
- package/docs/PROCESSED_OUTPUT.md +0 -157
- package/docs/PRODUCTION_COMPOSITION.md +0 -373
- package/docs/PRODUCTION_ENVIRONMENT_CAPTURE.md +0 -131
- package/docs/PROVENANCE.md +0 -115
- package/docs/PSF_FOUNDATION.md +0 -165
- package/docs/RAW_FRAME_ENVELOPE.md +0 -56
- package/docs/RAW_FRAME_RECONSTRUCTION.md +0 -30
- package/docs/RELEASE_1_0.md +0 -66
- package/docs/RELEASE_1_0_1.md +0 -61
- package/docs/RELEASE_1_1_0.md +0 -25
- package/docs/RELEASE_1_2_0.md +0 -51
- package/docs/RELEASE_1_3_0.md +0 -15
- package/docs/RELEASE_1_4_0.md +0 -23
- package/docs/RELEASE_1_5_0.md +0 -105
- package/docs/RELEASE_AUDIT.md +0 -39
- package/docs/SCENE_RADIANCE_AND_ILLUMINATION.md +0 -298
- package/docs/SCENE_SENSOR_QUADRATURE.md +0 -98
- package/docs/SCENE_SENSOR_TEMPORAL_EXPOSURE.md +0 -86
- package/docs/SCIENTIFIC_ASSURANCE.md +0 -280
- package/docs/SCIENTIFIC_CONFORMANCE.md +0 -83
- package/docs/SDR_RENDERING.md +0 -33
- package/docs/SENSOR_APERTURE_RAYS.md +0 -23
- package/docs/SENSOR_ENVIRONMENT_QUERY.md +0 -86
- package/docs/SENSOR_EQE_LOCAL_EXPOSURE.md +0 -104
- package/docs/SENSOR_EQE_TEMPORAL_EXPOSURE.md +0 -74
- package/docs/SENSOR_PSF_QUADRATURE.md +0 -90
- package/docs/SENSOR_RAW_FRAME.md +0 -20
- package/docs/SENSOR_RAW_PRODUCER.md +0 -77
- package/docs/SEPARABLE_EMISSION_DRAFT.md +0 -103
- package/docs/SIGNAL_CONFORMANCE.md +0 -23
- package/docs/SIMULATED_CAPTURE.md +0 -65
- package/docs/STABILIZATION.md +0 -234
- package/docs/TEMPORAL_PHOTO_RAW.md +0 -83
- package/docs/TIER_ACCEPTANCE.md +0 -129
- package/docs/TIER_PRESET_ACCEPTANCE.md +0 -59
- package/docs/V1_COMPOSITION_MAP.md +0 -123
- package/docs/V1_HELPER_REUSE_REVIEW.md +0 -60
- package/docs/V1_PERFORMANCE_DISPOSITION.md +0 -88
- package/docs/benchmarks/2026-10-01-main-baseline.json +0 -694
- package/docs/benchmarks/2026-10-02-geometric-preparation-reuse.json +0 -2190
- package/docs/benchmarks/2026-10-02-poc-projection-reuse.json +0 -2423
- package/docs/benchmarks/2026-10-02-v1-environment-gc-profile.json +0 -210
- package/docs/benchmarks/2026-10-02-v1-environment-ordinary.json +0 -187
- package/docs/benchmarks/2026-10-02-v1-geometry-gc-profile.json +0 -756
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-1.json +0 -711
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-2.json +0 -711
- package/docs/benchmarks/2026-10-02-v1-poc-gc-profile.json +0 -885
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-1.json +0 -868
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-2.json +0 -868
- package/docs/licenses/castleCSF-MIT.txt +0 -21
- package/docs/validation/dense-pupil-2026-10-06/pilot.jsonl +0 -6
- package/docs/validation/documentation-fragments.json +0 -212
- package/docs/validation/native-capture-sdr-darwin-arm64-node26-review.jsonl +0 -4
- package/docs/validation/native-capture-sdr-darwin-arm64.jsonl +0 -3
- package/docs/validation/native-raw-print-2026-10-04/fractional-asymmetric-crop.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/gray-ramp.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/linear-area-checker.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/manifest.json +0 -218
- package/docs/validation/native-raw-print-2026-10-04/megapixel-native.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/native-color.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel-validation.json +0 -9
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json +0 -29
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.codes.u16le.gz +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.rgb.gz +0 -0
- package/docs/validation/native-raw-print-2026-10-04/srgb.icc +0 -0
- package/docs/validation/native-raw-print-2026-10-04/validation.json +0 -41
- package/docs/validation/print-196-candidate-capabilities.json +0 -28
- package/docs/validation/print-196-candidate-evidence.json +0 -356
- package/docs/validation/print-196-engine-acceptance.json +0 -81
- package/docs/validation/print-detail-capabilities.json +0 -103
- package/docs/validation/print-detail-jpeg-evidence.json +0 -116
- package/docs/validation/print-detail-sdr-evidence.json +0 -81
- package/docs/validation/release-audit-inventory.json +0 -1306
- package/docs/validation/tier-acceptance-report-v1.json +0 -2538
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* CIELAB / CIELCh(ab) conversions and colour-difference formulae.
|
|
4
|
+
*
|
|
5
|
+
* - CIELAB (W3C CSS Color 4 Lab; also CIE 15:2018 §8.2.1) with the exact rational constants ε = (6/29)³ and
|
|
6
|
+
* κ = (29/3)³ in the linear segment.
|
|
7
|
+
* - ΔE*ab 1976: Euclidean CIELAB distance.
|
|
8
|
+
* - ΔE*94: asymmetric (first colour is the reference: S_L = 1, S_C = 1 + K₁C*₁, S_H = 1 + K₂C*₁). The
|
|
9
|
+
* default is the formula's published reference conditions (k_L = k_C = k_H = 1, K₁ = 0.045,
|
|
10
|
+
* K₂ = 0.015, often called "graphic arts"); callers may pass their own factors in `cie94Factors`.
|
|
11
|
+
* The engine ships no other preset. The primary source, CIE 116-1995, is not free. The tests check
|
|
12
|
+
* the closed forms for pure lightness, chroma and hue differences and the reference asymmetry.
|
|
13
|
+
* - CIEDE2000, implemented from the formula and implementation notes in Sharma, Wu & Dalal
|
|
14
|
+
* (2005), Color Res. Appl. 30(1):21–30 (paper free at
|
|
15
|
+
* https://hajim.rochester.edu/ece/sites/gsharma/ciede2000/; also CIE 142-2001, ISO/CIE 11664-6).
|
|
16
|
+
* This includes the hue-angle averaging and the handling of the hue discontinuity. The tests check
|
|
17
|
+
* its closed forms for pure lightness, chroma and hue differences (computed in the test), symmetry
|
|
18
|
+
* and identity; the published test pairs are not used (their data file has no licence).
|
|
19
|
+
* @see docs/COLORIMETRY.md for equations, coordinate/unit conventions and limits.
|
|
20
|
+
*/
|
|
21
|
+
import { calculatedResult } from "../core/calculation-result.js";
|
|
22
|
+
import { InvalidScientificInputError } from "../core/validation.js";
|
|
23
|
+
import { COLORIMETRY_MODEL_VERSION } from "./color-matching-functions.js";
|
|
24
|
+
import { parseWhiteXyz, parseXyz, requireFiniteNumber, requireFiniteResult, requireNonNegativeNumber, requirePositiveNumber, requireRecordValue } from "./colorimetry-math.js";
|
|
25
|
+
import { rejectUnknownFields, requireInputKeys } from "../core/record-validation.js";
|
|
26
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
27
|
+
const EPSILON = (6 / 29) ** 3;
|
|
28
|
+
const KAPPA = (29 / 3) ** 3;
|
|
29
|
+
function f(t) {
|
|
30
|
+
return t > EPSILON ? Math.cbrt(t) : (KAPPA * t + 16) / 116;
|
|
31
|
+
}
|
|
32
|
+
function fInverse(t) {
|
|
33
|
+
return t > 6 / 29 ? t ** 3 : (116 * t - 16) / KAPPA;
|
|
34
|
+
}
|
|
35
|
+
/** Internal: XYZ → CIELAB with a validated white (no envelope). */
|
|
36
|
+
export function cielabOfXyz(xyz, white) {
|
|
37
|
+
const fx = f(xyz.x / white.x), fy = f(xyz.y / white.y), fz = f(xyz.z / white.z);
|
|
38
|
+
return { lStar: 116 * fy - 16, aStar: 500 * (fx - fy), bStar: 200 * (fy - fz) };
|
|
39
|
+
}
|
|
40
|
+
/** Internal: CIELAB → XYZ. */
|
|
41
|
+
export function xyzOfCielab(lab, white) {
|
|
42
|
+
const fy = (lab.lStar + 16) / 116, fx = fy + lab.aStar / 500, fz = fy - lab.bStar / 200;
|
|
43
|
+
return { x: white.x * fInverse(fx), y: white.y * fInverse(fy), z: white.z * fInverse(fz) };
|
|
44
|
+
}
|
|
45
|
+
function parseLab(value, path) {
|
|
46
|
+
const r = requireRecordValue(value, path);
|
|
47
|
+
rejectUnknownFields(r, ["lStar", "aStar", "bStar"], path);
|
|
48
|
+
return { lStar: requireFiniteNumber(r.lStar, path + ".lStar"), aStar: requireFiniteNumber(r.aStar, path + ".aStar"), bStar: requireFiniteNumber(r.bStar, path + ".bStar") };
|
|
49
|
+
}
|
|
50
|
+
function parseWhite(value) {
|
|
51
|
+
const w = parseWhiteXyz(value, "referenceWhiteXyz");
|
|
52
|
+
if (!(w.x > 0) || !(w.z > 0))
|
|
53
|
+
throw new InvalidScientificInputError("referenceWhiteXyz components must be greater than zero.");
|
|
54
|
+
return w;
|
|
55
|
+
}
|
|
56
|
+
/** CIE XYZ → CIELAB relative to a reference white (same XYZ scale). */
|
|
57
|
+
export function calculateCielabFromXyz(input) {
|
|
58
|
+
requireInputKeys(input, "calculateCielabFromXyz", ["xyz", "referenceWhiteXyz"]);
|
|
59
|
+
const lab = cielabOfXyz(parseXyz(input.xyz, "xyz"), parseWhite(input.referenceWhiteXyz));
|
|
60
|
+
requireFiniteResult([lab.lStar, lab.aStar, lab.bStar], "CIELAB conversion");
|
|
61
|
+
return calculatedResult(lab, "cielab-1976", COLORIMETRY_MODEL_VERSION, ["CIELAB as defined in W3C CSS Color 4 (Lab) with exact (6/29)³ and (29/3)³ constants"]);
|
|
62
|
+
}
|
|
63
|
+
/** CIELAB → CIE XYZ relative to a reference white. */
|
|
64
|
+
export function calculateXyzFromCielab(input) {
|
|
65
|
+
requireInputKeys(input, "calculateXyzFromCielab", ["lab", "referenceWhiteXyz"]);
|
|
66
|
+
const xyz = xyzOfCielab(parseLab(input.lab, "lab"), parseWhite(input.referenceWhiteXyz));
|
|
67
|
+
requireFiniteResult([xyz.x, xyz.y, xyz.z], "CIELAB inverse");
|
|
68
|
+
return calculatedResult(xyz, "cielab-1976-inverse", COLORIMETRY_MODEL_VERSION, ["CIELAB inverse as defined in W3C CSS Color 4 (Lab)"]);
|
|
69
|
+
}
|
|
70
|
+
/** Internal: CIELAB → LCh(ab). */
|
|
71
|
+
export function cielchOfCielab(lab) {
|
|
72
|
+
const hue = (Math.atan2(lab.bStar, lab.aStar) * 180) / Math.PI;
|
|
73
|
+
return { lStar: lab.lStar, chromaStar: Math.hypot(lab.aStar, lab.bStar), hueDegrees: hue < 0 ? hue + 360 : hue };
|
|
74
|
+
}
|
|
75
|
+
/** Internal: LCh(ab) → CIELAB. */
|
|
76
|
+
export function cielabOfCielch(lch) {
|
|
77
|
+
const h = (lch.hueDegrees * Math.PI) / 180;
|
|
78
|
+
return { lStar: lch.lStar, aStar: lch.chromaStar * Math.cos(h), bStar: lch.chromaStar * Math.sin(h) };
|
|
79
|
+
}
|
|
80
|
+
/** CIELAB → CIE LCh(ab): C*ab = √(a*² + b*²), h_ab = atan2(b*, a*) in degrees. */
|
|
81
|
+
export function calculateCielchFromCielab(input) {
|
|
82
|
+
requireInputKeys(input, "calculateCielchFromCielab", ["lab"]);
|
|
83
|
+
return calculatedResult(cielchOfCielab(parseLab(input.lab, "lab")), "cielch-ab", COLORIMETRY_MODEL_VERSION);
|
|
84
|
+
}
|
|
85
|
+
/** CIE LCh(ab) → CIELAB. */
|
|
86
|
+
export function calculateCielabFromCielch(input) {
|
|
87
|
+
requireInputKeys(input, "calculateCielabFromCielch", ["lch"]);
|
|
88
|
+
const r = requireRecordValue(input.lch, "lch");
|
|
89
|
+
rejectUnknownFields(r, ["lStar", "chromaStar", "hueDegrees"], "lch");
|
|
90
|
+
const lch = {
|
|
91
|
+
lStar: requireFiniteNumber(r.lStar, "lch.lStar"),
|
|
92
|
+
chromaStar: requireFiniteNumber(r.chromaStar, "lch.chromaStar"),
|
|
93
|
+
hueDegrees: requireFiniteNumber(r.hueDegrees, "lch.hueDegrees")
|
|
94
|
+
};
|
|
95
|
+
if (lch.chromaStar < 0)
|
|
96
|
+
throw new InvalidScientificInputError("lch.chromaStar must not be negative.");
|
|
97
|
+
return calculatedResult(cielabOfCielch(lch), "cielch-ab-inverse", COLORIMETRY_MODEL_VERSION);
|
|
98
|
+
}
|
|
99
|
+
/** CIE94 reference conditions (k_L = k_C = k_H = 1, K₁ = 0.045, K₂ = 0.015). */
|
|
100
|
+
const CIE94_REFERENCE_FACTORS = { lightness: 1, chroma: 1, hue: 1, k1: 0.045, k2: 0.015 };
|
|
101
|
+
const DEG = Math.PI / 180;
|
|
102
|
+
/** Internal: ΔE*ab 1976. */
|
|
103
|
+
export function deltaE76(a, b) {
|
|
104
|
+
return Math.hypot(a.lStar - b.lStar, a.aStar - b.aStar, a.bStar - b.bStar);
|
|
105
|
+
}
|
|
106
|
+
/** Internal: ΔE*94 with reference colour `reference`. */
|
|
107
|
+
export function deltaE94(reference, sample, factors = CIE94_REFERENCE_FACTORS) {
|
|
108
|
+
const { lightness: kL, chroma: kC, hue: kH, k1, k2 } = factors;
|
|
109
|
+
const c1 = Math.hypot(reference.aStar, reference.bStar), c2 = Math.hypot(sample.aStar, sample.bStar);
|
|
110
|
+
const dL = reference.lStar - sample.lStar, dC = c1 - c2;
|
|
111
|
+
const da = reference.aStar - sample.aStar, db = reference.bStar - sample.bStar;
|
|
112
|
+
const dH2 = Math.max(0, da * da + db * db - dC * dC);
|
|
113
|
+
const sC = 1 + k1 * c1, sH = 1 + k2 * c1;
|
|
114
|
+
return Math.sqrt((dL / kL) ** 2 + (dC / (kC * sC)) ** 2 + dH2 / (kH * sH) ** 2);
|
|
115
|
+
}
|
|
116
|
+
function hueDegrees(b, a) {
|
|
117
|
+
if (a === 0 && b === 0)
|
|
118
|
+
return 0;
|
|
119
|
+
const h = Math.atan2(b, a) / DEG;
|
|
120
|
+
return h < 0 ? h + 360 : h;
|
|
121
|
+
}
|
|
122
|
+
/** Internal: CIEDE2000 (Sharma, Wu & Dalal 2005 implementation notes). */
|
|
123
|
+
export function deltaE2000(lab1, lab2, k = { lightness: 1, chroma: 1, hue: 1 }) {
|
|
124
|
+
const pow25to7 = 25 ** 7;
|
|
125
|
+
const c1 = Math.hypot(lab1.aStar, lab1.bStar), c2 = Math.hypot(lab2.aStar, lab2.bStar);
|
|
126
|
+
const cBar7 = ((c1 + c2) / 2) ** 7;
|
|
127
|
+
const g = 0.5 * (1 - Math.sqrt(cBar7 / (cBar7 + pow25to7)));
|
|
128
|
+
const a1 = (1 + g) * lab1.aStar, a2 = (1 + g) * lab2.aStar;
|
|
129
|
+
const cp1 = Math.hypot(a1, lab1.bStar), cp2 = Math.hypot(a2, lab2.bStar);
|
|
130
|
+
const hp1 = hueDegrees(lab1.bStar, a1), hp2 = hueDegrees(lab2.bStar, a2);
|
|
131
|
+
const dL = lab2.lStar - lab1.lStar, dC = cp2 - cp1;
|
|
132
|
+
const chromaProduct = cp1 * cp2;
|
|
133
|
+
let dh = 0;
|
|
134
|
+
if (chromaProduct !== 0) {
|
|
135
|
+
dh = hp2 - hp1;
|
|
136
|
+
if (dh > 180)
|
|
137
|
+
dh -= 360;
|
|
138
|
+
else if (dh < -180)
|
|
139
|
+
dh += 360;
|
|
140
|
+
}
|
|
141
|
+
const dH = 2 * Math.sqrt(chromaProduct) * Math.sin((dh * DEG) / 2);
|
|
142
|
+
const lBar = (lab1.lStar + lab2.lStar) / 2, cBarP = (cp1 + cp2) / 2;
|
|
143
|
+
let hBar = hp1 + hp2;
|
|
144
|
+
if (chromaProduct !== 0) {
|
|
145
|
+
if (Math.abs(hp1 - hp2) <= 180)
|
|
146
|
+
hBar /= 2;
|
|
147
|
+
else
|
|
148
|
+
hBar = hBar < 360 ? (hBar + 360) / 2 : (hBar - 360) / 2;
|
|
149
|
+
}
|
|
150
|
+
const t = 1 - 0.17 * Math.cos((hBar - 30) * DEG) + 0.24 * Math.cos(2 * hBar * DEG) + 0.32 * Math.cos((3 * hBar + 6) * DEG) - 0.20 * Math.cos((4 * hBar - 63) * DEG);
|
|
151
|
+
const dTheta = 30 * Math.exp(-(((hBar - 275) / 25) ** 2));
|
|
152
|
+
const cBarP7 = cBarP ** 7;
|
|
153
|
+
const rC = 2 * Math.sqrt(cBarP7 / (cBarP7 + pow25to7));
|
|
154
|
+
const l50 = (lBar - 50) ** 2;
|
|
155
|
+
const sL = 1 + (0.015 * l50) / Math.sqrt(20 + l50), sC = 1 + 0.045 * cBarP, sH = 1 + 0.015 * cBarP * t;
|
|
156
|
+
const rT = -Math.sin(2 * dTheta * DEG) * rC;
|
|
157
|
+
const tl = dL / (k.lightness * sL), tc = dC / (k.chroma * sC), th = dH / (k.hue * sH);
|
|
158
|
+
return Math.sqrt(Math.max(0, tl * tl + tc * tc + th * th + rT * tc * th));
|
|
159
|
+
}
|
|
160
|
+
function parseCie94Factors(value) {
|
|
161
|
+
const r = requireRecordValue(value, "cie94Factors");
|
|
162
|
+
requireInputKeys(r, "calculateColorDifference cie94Factors", ["lightness", "chroma", "hue", "k1", "k2"]);
|
|
163
|
+
return {
|
|
164
|
+
lightness: requirePositiveNumber(r.lightness, "cie94Factors.lightness"),
|
|
165
|
+
chroma: requirePositiveNumber(r.chroma, "cie94Factors.chroma"),
|
|
166
|
+
hue: requirePositiveNumber(r.hue, "cie94Factors.hue"),
|
|
167
|
+
k1: requireNonNegativeNumber(r.k1, "cie94Factors.k1"),
|
|
168
|
+
k2: requireNonNegativeNumber(r.k2, "cie94Factors.k2")
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** Colour difference between two CIELAB colours with an explicit formula. */
|
|
172
|
+
export function calculateColorDifference(input) {
|
|
173
|
+
requireInputKeys(input, "calculateColorDifference", ["reference", "sample", "formula", "parametricFactors", "cie94Factors"]);
|
|
174
|
+
const reference = parseLab(input.reference, "reference");
|
|
175
|
+
const sample = parseLab(input.sample, "sample");
|
|
176
|
+
let deltaE;
|
|
177
|
+
switch (input.formula) {
|
|
178
|
+
case "cie76":
|
|
179
|
+
deltaE = deltaE76(reference, sample);
|
|
180
|
+
break;
|
|
181
|
+
case "cie94":
|
|
182
|
+
deltaE = deltaE94(reference, sample, input.cie94Factors === undefined ? undefined : parseCie94Factors(input.cie94Factors));
|
|
183
|
+
break;
|
|
184
|
+
case "ciede2000": {
|
|
185
|
+
let k;
|
|
186
|
+
if (input.parametricFactors !== undefined) {
|
|
187
|
+
const r = requireRecordValue(input.parametricFactors, "parametricFactors");
|
|
188
|
+
requireInputKeys(r, "calculateColorDifference parametricFactors", ["lightness", "chroma", "hue"]);
|
|
189
|
+
k = { lightness: requirePositiveNumber(r.lightness, "parametricFactors.lightness"), chroma: requirePositiveNumber(r.chroma, "parametricFactors.chroma"), hue: requirePositiveNumber(r.hue, "parametricFactors.hue") };
|
|
190
|
+
}
|
|
191
|
+
deltaE = deltaE2000(reference, sample, k);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
default: throw new InvalidConfigurationError("formula is not supported.");
|
|
195
|
+
}
|
|
196
|
+
requireFiniteResult([deltaE], "Colour difference");
|
|
197
|
+
if (input.formula !== "ciede2000" && input.parametricFactors !== undefined) {
|
|
198
|
+
throw new InvalidScientificInputError("parametricFactors apply only to CIEDE2000.");
|
|
199
|
+
}
|
|
200
|
+
if (input.formula !== "cie94" && input.cie94Factors !== undefined) {
|
|
201
|
+
throw new InvalidScientificInputError("cie94Factors apply only to CIE94.");
|
|
202
|
+
}
|
|
203
|
+
return calculatedResult({ deltaE, formula: input.formula }, "color-difference-" + input.formula, COLORIMETRY_MODEL_VERSION);
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=color-difference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-difference.js","sourceRoot":"","sources":["../../src/color/color-difference.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,gBAAgB,EAA0B,MAAM,+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C;IACnD,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,IAAI,KAAK,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC3E,MAAM,IAAI,2BAA2B,CAAC,4CAA4C,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QAClE,MAAM,IAAI,2BAA2B,CAAC,mCAAmC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,gBAAgB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,mBAAmB,GAAG,KAAK,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;AAC9H,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * CIELAB / CIELCh(ab) conversions and colour-difference formulae.\n *\n * - CIELAB (W3C CSS Color 4 Lab; also CIE 15:2018 §8.2.1) with the exact rational constants ε = (6/29)³ and\n * κ = (29/3)³ in the linear segment.\n * - ΔE*ab 1976: Euclidean CIELAB distance.\n * - ΔE*94: asymmetric (first colour is the reference: S_L = 1, S_C = 1 + K₁C*₁, S_H = 1 + K₂C*₁). The\n * default is the formula's published reference conditions (k_L = k_C = k_H = 1, K₁ = 0.045,\n * K₂ = 0.015, often called \"graphic arts\"); callers may pass their own factors in `cie94Factors`.\n * The engine ships no other preset. The primary source, CIE 116-1995, is not free. The tests check\n * the closed forms for pure lightness, chroma and hue differences and the reference asymmetry.\n * - CIEDE2000, implemented from the formula and implementation notes in Sharma, Wu & Dalal\n * (2005), Color Res. Appl. 30(1):21–30 (paper free at\n * https://hajim.rochester.edu/ece/sites/gsharma/ciede2000/; also CIE 142-2001, ISO/CIE 11664-6).\n * This includes the hue-angle averaging and the handling of the hue discontinuity. The tests check\n * its closed forms for pure lightness, chroma and hue differences (computed in the test), symmetry\n * and identity; the published test pairs are not used (their data file has no licence).\n * @see docs/COLORIMETRY.md for equations, coordinate/unit conventions and limits.\n */\n\nimport { calculatedResult, type CalculationResult } from \"../core/calculation-result.js\";\nimport { InvalidScientificInputError } from \"../core/validation.js\";\nimport { COLORIMETRY_MODEL_VERSION } from \"./color-matching-functions.js\";\nimport {\n parseWhiteXyz,\n parseXyz,\n requireFiniteNumber,\n requireFiniteResult,\n requireNonNegativeNumber,\n requirePositiveNumber,\n requireRecordValue,\n type CieXyzTristimulus\n} from \"./colorimetry-math.js\";\nimport { rejectUnknownFields, requireInputKeys } from \"../core/record-validation.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\n\n/** CIE 1976 L*a*b* coordinates. */\nexport interface CielabColor {\n lStar: number;\n aStar: number;\n bStar: number;\n}\n\n/** CIE 1976 L*C*h(ab) coordinates; hue in degrees [0, 360). */\nexport interface CielchColor {\n lStar: number;\n chromaStar: number;\n hueDegrees: number;\n}\n\nconst EPSILON = (6 / 29) ** 3;\nconst KAPPA = (29 / 3) ** 3;\n\nfunction f(t: number): number {\n return t > EPSILON ? Math.cbrt(t) : (KAPPA * t + 16) / 116;\n}\nfunction fInverse(t: number): number {\n return t > 6 / 29 ? t ** 3 : (116 * t - 16) / KAPPA;\n}\n\n/** Internal: XYZ → CIELAB with a validated white (no envelope). */\nexport function cielabOfXyz(xyz: CieXyzTristimulus, white: CieXyzTristimulus): CielabColor {\n const fx = f(xyz.x / white.x), fy = f(xyz.y / white.y), fz = f(xyz.z / white.z);\n return { lStar: 116 * fy - 16, aStar: 500 * (fx - fy), bStar: 200 * (fy - fz) };\n}\n\n/** Internal: CIELAB → XYZ. */\nexport function xyzOfCielab(lab: CielabColor, white: CieXyzTristimulus): CieXyzTristimulus {\n const fy = (lab.lStar + 16) / 116, fx = fy + lab.aStar / 500, fz = fy - lab.bStar / 200;\n return { x: white.x * fInverse(fx), y: white.y * fInverse(fy), z: white.z * fInverse(fz) };\n}\n\nfunction parseLab(value: unknown, path: string): CielabColor {\n const r = requireRecordValue(value, path);\n rejectUnknownFields(r, [\"lStar\", \"aStar\", \"bStar\"], path);\n return { lStar: requireFiniteNumber(r.lStar, path + \".lStar\"), aStar: requireFiniteNumber(r.aStar, path + \".aStar\"), bStar: requireFiniteNumber(r.bStar, path + \".bStar\") };\n}\n\nfunction parseWhite(value: unknown): CieXyzTristimulus {\n const w = parseWhiteXyz(value, \"referenceWhiteXyz\");\n if (!(w.x > 0) || !(w.z > 0)) throw new InvalidScientificInputError(\"referenceWhiteXyz components must be greater than zero.\");\n return w;\n}\n\n/** CIE XYZ → CIELAB relative to a reference white (same XYZ scale). */\nexport function calculateCielabFromXyz(input: { xyz: CieXyzTristimulus; referenceWhiteXyz: CieXyzTristimulus }): CalculationResult<CielabColor> {\n requireInputKeys(input, \"calculateCielabFromXyz\", [\"xyz\", \"referenceWhiteXyz\"]);\n const lab = cielabOfXyz(parseXyz(input.xyz, \"xyz\"), parseWhite(input.referenceWhiteXyz));\n requireFiniteResult([lab.lStar, lab.aStar, lab.bStar], \"CIELAB conversion\");\n return calculatedResult(lab, \"cielab-1976\", COLORIMETRY_MODEL_VERSION, [\"CIELAB as defined in W3C CSS Color 4 (Lab) with exact (6/29)³ and (29/3)³ constants\"]);\n}\n\n/** CIELAB → CIE XYZ relative to a reference white. */\nexport function calculateXyzFromCielab(input: { lab: CielabColor; referenceWhiteXyz: CieXyzTristimulus }): CalculationResult<CieXyzTristimulus> {\n requireInputKeys(input, \"calculateXyzFromCielab\", [\"lab\", \"referenceWhiteXyz\"]);\n const xyz = xyzOfCielab(parseLab(input.lab, \"lab\"), parseWhite(input.referenceWhiteXyz));\n requireFiniteResult([xyz.x, xyz.y, xyz.z], \"CIELAB inverse\");\n return calculatedResult(xyz, \"cielab-1976-inverse\", COLORIMETRY_MODEL_VERSION, [\"CIELAB inverse as defined in W3C CSS Color 4 (Lab)\"]);\n}\n\n/** Internal: CIELAB → LCh(ab). */\nexport function cielchOfCielab(lab: CielabColor): CielchColor {\n const hue = (Math.atan2(lab.bStar, lab.aStar) * 180) / Math.PI;\n return { lStar: lab.lStar, chromaStar: Math.hypot(lab.aStar, lab.bStar), hueDegrees: hue < 0 ? hue + 360 : hue };\n}\n\n/** Internal: LCh(ab) → CIELAB. */\nexport function cielabOfCielch(lch: CielchColor): CielabColor {\n const h = (lch.hueDegrees * Math.PI) / 180;\n return { lStar: lch.lStar, aStar: lch.chromaStar * Math.cos(h), bStar: lch.chromaStar * Math.sin(h) };\n}\n\n/** CIELAB → CIE LCh(ab): C*ab = √(a*² + b*²), h_ab = atan2(b*, a*) in degrees. */\nexport function calculateCielchFromCielab(input: { lab: CielabColor }): CalculationResult<CielchColor> {\n requireInputKeys(input, \"calculateCielchFromCielab\", [\"lab\"]);\n return calculatedResult(cielchOfCielab(parseLab(input.lab, \"lab\")), \"cielch-ab\", COLORIMETRY_MODEL_VERSION);\n}\n\n/** CIE LCh(ab) → CIELAB. */\nexport function calculateCielabFromCielch(input: { lch: CielchColor }): CalculationResult<CielabColor> {\n requireInputKeys(input, \"calculateCielabFromCielch\", [\"lch\"]);\n const r = requireRecordValue(input.lch, \"lch\");\n rejectUnknownFields(r, [\"lStar\", \"chromaStar\", \"hueDegrees\"], \"lch\");\n const lch = {\n lStar: requireFiniteNumber(r.lStar, \"lch.lStar\"),\n chromaStar: requireFiniteNumber(r.chromaStar, \"lch.chromaStar\"),\n hueDegrees: requireFiniteNumber(r.hueDegrees, \"lch.hueDegrees\")\n };\n if (lch.chromaStar < 0) throw new InvalidScientificInputError(\"lch.chromaStar must not be negative.\");\n return calculatedResult(cielabOfCielch(lch), \"cielch-ab-inverse\", COLORIMETRY_MODEL_VERSION);\n}\n\n/** Colour-difference formula. */\nexport type ColorDifferenceFormula = \"cie76\" | \"cie94\" | \"ciede2000\";\n\n/** CIEDE2000 parametric factors (default 1, 1, 1 for reference conditions). */\nexport interface Ciede2000ParametricFactors {\n lightness: number;\n chroma: number;\n hue: number;\n}\n\n/**\n * CIE94 parametric factors k_L, k_C, k_H and weighting constants K₁, K₂ (S_C = 1 + K₁C*₁,\n * S_H = 1 + K₂C*₁). The default is the reference conditions: 1, 1, 1, 0.045, 0.015.\n */\nexport interface Cie94ParametricFactors {\n /** k_L, greater than zero. */\n lightness: number;\n /** k_C, greater than zero. */\n chroma: number;\n /** k_H, greater than zero. */\n hue: number;\n /** K₁ in S_C = 1 + K₁C*₁; finite and not negative. */\n k1: number;\n /** K₂ in S_H = 1 + K₂C*₁; finite and not negative. */\n k2: number;\n}\n\n/** CIE94 reference conditions (k_L = k_C = k_H = 1, K₁ = 0.045, K₂ = 0.015). */\nconst CIE94_REFERENCE_FACTORS: Cie94ParametricFactors = { lightness: 1, chroma: 1, hue: 1, k1: 0.045, k2: 0.015 };\n\nconst DEG = Math.PI / 180;\n\n/** Internal: ΔE*ab 1976. */\nexport function deltaE76(a: CielabColor, b: CielabColor): number {\n return Math.hypot(a.lStar - b.lStar, a.aStar - b.aStar, a.bStar - b.bStar);\n}\n\n/** Internal: ΔE*94 with reference colour `reference`. */\nexport function deltaE94(reference: CielabColor, sample: CielabColor, factors: Cie94ParametricFactors = CIE94_REFERENCE_FACTORS): number {\n const { lightness: kL, chroma: kC, hue: kH, k1, k2 } = factors;\n const c1 = Math.hypot(reference.aStar, reference.bStar), c2 = Math.hypot(sample.aStar, sample.bStar);\n const dL = reference.lStar - sample.lStar, dC = c1 - c2;\n const da = reference.aStar - sample.aStar, db = reference.bStar - sample.bStar;\n const dH2 = Math.max(0, da * da + db * db - dC * dC);\n const sC = 1 + k1 * c1, sH = 1 + k2 * c1;\n return Math.sqrt((dL / kL) ** 2 + (dC / (kC * sC)) ** 2 + dH2 / (kH * sH) ** 2);\n}\n\nfunction hueDegrees(b: number, a: number): number {\n if (a === 0 && b === 0) return 0;\n const h = Math.atan2(b, a) / DEG;\n return h < 0 ? h + 360 : h;\n}\n\n/** Internal: CIEDE2000 (Sharma, Wu & Dalal 2005 implementation notes). */\nexport function deltaE2000(lab1: CielabColor, lab2: CielabColor, k: Ciede2000ParametricFactors = { lightness: 1, chroma: 1, hue: 1 }): number {\n const pow25to7 = 25 ** 7;\n const c1 = Math.hypot(lab1.aStar, lab1.bStar), c2 = Math.hypot(lab2.aStar, lab2.bStar);\n const cBar7 = ((c1 + c2) / 2) ** 7;\n const g = 0.5 * (1 - Math.sqrt(cBar7 / (cBar7 + pow25to7)));\n const a1 = (1 + g) * lab1.aStar, a2 = (1 + g) * lab2.aStar;\n const cp1 = Math.hypot(a1, lab1.bStar), cp2 = Math.hypot(a2, lab2.bStar);\n const hp1 = hueDegrees(lab1.bStar, a1), hp2 = hueDegrees(lab2.bStar, a2);\n const dL = lab2.lStar - lab1.lStar, dC = cp2 - cp1;\n const chromaProduct = cp1 * cp2;\n let dh = 0;\n if (chromaProduct !== 0) {\n dh = hp2 - hp1;\n if (dh > 180) dh -= 360;\n else if (dh < -180) dh += 360;\n }\n const dH = 2 * Math.sqrt(chromaProduct) * Math.sin((dh * DEG) / 2);\n const lBar = (lab1.lStar + lab2.lStar) / 2, cBarP = (cp1 + cp2) / 2;\n let hBar = hp1 + hp2;\n if (chromaProduct !== 0) {\n if (Math.abs(hp1 - hp2) <= 180) hBar /= 2;\n else hBar = hBar < 360 ? (hBar + 360) / 2 : (hBar - 360) / 2;\n }\n const t = 1 - 0.17 * Math.cos((hBar - 30) * DEG) + 0.24 * Math.cos(2 * hBar * DEG) + 0.32 * Math.cos((3 * hBar + 6) * DEG) - 0.20 * Math.cos((4 * hBar - 63) * DEG);\n const dTheta = 30 * Math.exp(-(((hBar - 275) / 25) ** 2));\n const cBarP7 = cBarP ** 7;\n const rC = 2 * Math.sqrt(cBarP7 / (cBarP7 + pow25to7));\n const l50 = (lBar - 50) ** 2;\n const sL = 1 + (0.015 * l50) / Math.sqrt(20 + l50), sC = 1 + 0.045 * cBarP, sH = 1 + 0.015 * cBarP * t;\n const rT = -Math.sin(2 * dTheta * DEG) * rC;\n const tl = dL / (k.lightness * sL), tc = dC / (k.chroma * sC), th = dH / (k.hue * sH);\n return Math.sqrt(Math.max(0, tl * tl + tc * tc + th * th + rT * tc * th));\n}\n\nexport interface CalculateColorDifferenceInput {\n /** Reference (standard) colour; ΔE94 is asymmetric in it. */\n reference: CielabColor;\n sample: CielabColor;\n formula: ColorDifferenceFormula;\n /** CIEDE2000 only; defaults to 1, 1, 1. */\n parametricFactors?: Ciede2000ParametricFactors;\n /** CIE94 only; all five fields are required when given. Defaults to the reference conditions 1, 1, 1, 0.045, 0.015. */\n cie94Factors?: Cie94ParametricFactors;\n}\n\nfunction parseCie94Factors(value: unknown): Cie94ParametricFactors {\n const r = requireRecordValue(value, \"cie94Factors\");\n requireInputKeys(r, \"calculateColorDifference cie94Factors\", [\"lightness\", \"chroma\", \"hue\", \"k1\", \"k2\"]);\n return {\n lightness: requirePositiveNumber(r.lightness, \"cie94Factors.lightness\"),\n chroma: requirePositiveNumber(r.chroma, \"cie94Factors.chroma\"),\n hue: requirePositiveNumber(r.hue, \"cie94Factors.hue\"),\n k1: requireNonNegativeNumber(r.k1, \"cie94Factors.k1\"),\n k2: requireNonNegativeNumber(r.k2, \"cie94Factors.k2\")\n };\n}\n\n/** Colour difference between two CIELAB colours with an explicit formula. */\nexport function calculateColorDifference(input: CalculateColorDifferenceInput): CalculationResult<{ deltaE: number; formula: ColorDifferenceFormula }> {\n requireInputKeys(input, \"calculateColorDifference\", [\"reference\", \"sample\", \"formula\", \"parametricFactors\", \"cie94Factors\"]);\n const reference = parseLab(input.reference, \"reference\");\n const sample = parseLab(input.sample, \"sample\");\n let deltaE: number;\n switch (input.formula) {\n case \"cie76\": deltaE = deltaE76(reference, sample); break;\n case \"cie94\": deltaE = deltaE94(reference, sample, input.cie94Factors === undefined ? undefined : parseCie94Factors(input.cie94Factors)); break;\n case \"ciede2000\": {\n let k: Ciede2000ParametricFactors | undefined;\n if (input.parametricFactors !== undefined) {\n const r = requireRecordValue(input.parametricFactors, \"parametricFactors\");\n requireInputKeys(r, \"calculateColorDifference parametricFactors\", [\"lightness\", \"chroma\", \"hue\"]);\n k = { lightness: requirePositiveNumber(r.lightness, \"parametricFactors.lightness\"), chroma: requirePositiveNumber(r.chroma, \"parametricFactors.chroma\"), hue: requirePositiveNumber(r.hue, \"parametricFactors.hue\") };\n }\n deltaE = deltaE2000(reference, sample, k);\n break;\n }\n default: throw new InvalidConfigurationError(\"formula is not supported.\");\n }\n requireFiniteResult([deltaE], \"Colour difference\");\n if (input.formula !== \"ciede2000\" && input.parametricFactors !== undefined) {\n throw new InvalidScientificInputError(\"parametricFactors apply only to CIEDE2000.\");\n }\n if (input.formula !== \"cie94\" && input.cie94Factors !== undefined) {\n throw new InvalidScientificInputError(\"cie94Factors apply only to CIE94.\");\n }\n return calculatedResult({ deltaE, formula: input.formula }, \"color-difference-\" + input.formula, COLORIMETRY_MODEL_VERSION);\n}\n"]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CIE colour-matching functions (CMFs) and spectrum → CIE XYZ integration.
|
|
3
|
+
*
|
|
4
|
+
* Two CMF sources are supported:
|
|
5
|
+
* 1. The engine's own analytic APPROXIMATION of the CIE 1931 2° observer. Each of x̄, ȳ, z̄ is a sum
|
|
6
|
+
* of split Gaussian lobes (a lobe has an amplitude, a centre, and separate widths below and above
|
|
7
|
+
* the centre): three lobes for x̄, two each for ȳ and z̄. The engine fitted the coefficients itself
|
|
8
|
+
* by non-negative least squares to the CIE 1931 2° table (DOI 10.25039/CIE.DS.xvudnb9b) at 1 nm
|
|
9
|
+
* from 360 to 830 nm, with `scripts/fit-cie-1931-cmf.mjs`. The table is used only when the fit is
|
|
10
|
+
* run and is not stored in the repository. Measured fit error (maximum absolute / RMS): x̄ 0.0122 /
|
|
11
|
+
* 0.00426, ȳ 0.00733 / 0.00265, z̄ 0.0221 / 0.00397; see docs/COLORIMETRY.md.
|
|
12
|
+
* 2. Caller-supplied tabulated CMFs, for example the official CIE datasets. The CIE
|
|
13
|
+
* distributes those under CC BY-SA 4.0, so they are NOT bundled with this Apache-2.0
|
|
14
|
+
* package. Tables are linearly interpolated. Outside their declared range they throw
|
|
15
|
+
* (fail closed); there is no extrapolation.
|
|
16
|
+
*
|
|
17
|
+
* Integration uses explicit wavelength quadrature nodes `{wavelengthNanometers,
|
|
18
|
+
* wavelengthMeasureNanometers}`. Nodes from `calculateSensorSpectralQuadrature()` have the
|
|
19
|
+
* same shape and can be passed directly. X = k Σ S(λᵢ) R(λᵢ) x̄(λᵢ) Δλᵢ: a quadrature of the tristimulus
|
|
20
|
+
* integral X = ∫ L(λ) x̄(λ) dλ with stimulus L = S·R (Wyman, Sloan & Shirley 2013, JCGT 2(2), Eq. 1, free;
|
|
21
|
+
* also CIE 15:2018 §7.1). The normalization k and the quadrature nodes are explicit choices.
|
|
22
|
+
* @see docs/COLORIMETRY.md for equations, coordinate/unit conventions and limits.
|
|
23
|
+
*/
|
|
24
|
+
import { type CalculationResult } from "../core/calculation-result.js";
|
|
25
|
+
import type { SpectralWavelengthRangeNanometers, SpectralWavelengthSample } from "../core/spectral.js";
|
|
26
|
+
import { type CieXyChromaticity, type CieXyzTristimulus } from "./colorimetry-math.js";
|
|
27
|
+
export declare const COLORIMETRY_MODEL_VERSION: "2.0.0";
|
|
28
|
+
/** Upper bound on quadrature nodes per integration call. */
|
|
29
|
+
export declare const MAX_COLORIMETRIC_QUADRATURE_NODES = 100000;
|
|
30
|
+
/** Upper bound on samples in a caller-supplied tabulated spectrum or CMF table. */
|
|
31
|
+
export declare const MAX_COLORIMETRIC_TABLE_SAMPLES = 100000;
|
|
32
|
+
/** Wavelength domain over which the analytic CIE 1931 fit is accepted (the domain it was fitted on). */
|
|
33
|
+
export declare const ANALYTIC_CIE_1931_CMF_DOMAIN_NANOMETERS: Readonly<SpectralWavelengthRangeNanometers>;
|
|
34
|
+
/** One wavelength quadrature node; d-lambda is in nanometres. */
|
|
35
|
+
export interface ColorimetricQuadratureNode {
|
|
36
|
+
wavelengthNanometers: number;
|
|
37
|
+
wavelengthMeasureNanometers: number;
|
|
38
|
+
}
|
|
39
|
+
/** One tabulated spectral value at one wavelength. */
|
|
40
|
+
export interface ColorimetricSpectralSample extends SpectralWavelengthSample {
|
|
41
|
+
value: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A spectral distribution or spectral factor (reflectance, transmittance, relative SPD,
|
|
45
|
+
* sensitivity).
|
|
46
|
+
* - `tabulated` is the JSON form: strictly increasing wavelengths, linear interpolation, and an
|
|
47
|
+
* error (fail closed) outside the table.
|
|
48
|
+
* - `function` is an in-process evaluator (for example a Planckian SPD). It must be finite over
|
|
49
|
+
* its declared range.
|
|
50
|
+
*/
|
|
51
|
+
export type ColorimetricSpectrum = {
|
|
52
|
+
kind: "tabulated";
|
|
53
|
+
samples: readonly ColorimetricSpectralSample[];
|
|
54
|
+
} | {
|
|
55
|
+
kind: "function";
|
|
56
|
+
wavelengthRangeNanometers: SpectralWavelengthRangeNanometers;
|
|
57
|
+
evaluate: (wavelengthNanometers: number) => number;
|
|
58
|
+
};
|
|
59
|
+
/** One tabulated colour-matching sample. */
|
|
60
|
+
export interface TabulatedColorMatchingSample extends SpectralWavelengthSample {
|
|
61
|
+
xBar: number;
|
|
62
|
+
yBar: number;
|
|
63
|
+
zBar: number;
|
|
64
|
+
}
|
|
65
|
+
export type ColorimetricObserver = "cie-1931-2-degree" | "cie-1964-10-degree" | "caller-defined";
|
|
66
|
+
/** Selects a colour-matching-function source. */
|
|
67
|
+
export type ColorMatchingFunctionsSource = {
|
|
68
|
+
kind: "analytic-cie-1931-multi-lobe-fit";
|
|
69
|
+
} | {
|
|
70
|
+
kind: "tabulated";
|
|
71
|
+
observer: ColorimetricObserver;
|
|
72
|
+
/** Caller identity for the dataset (for example a DOI); recorded in provenance. */
|
|
73
|
+
datasetId: string;
|
|
74
|
+
samples: readonly TabulatedColorMatchingSample[];
|
|
75
|
+
};
|
|
76
|
+
/** Validated, reusable colour-matching functions. */
|
|
77
|
+
export interface PreparedColorMatchingFunctions {
|
|
78
|
+
observer: ColorimetricObserver;
|
|
79
|
+
sourceKind: ColorMatchingFunctionsSource["kind"];
|
|
80
|
+
datasetId: string;
|
|
81
|
+
scientificStatus: "approximation" | "caller-tabulated";
|
|
82
|
+
wavelengthRangeNanometers: SpectralWavelengthRangeNanometers;
|
|
83
|
+
/** x̄, ȳ, z̄ at one wavelength in nm; throws outside the declared range. */
|
|
84
|
+
evaluate(wavelengthNanometers: number): CieXyzTristimulus;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Evaluates the engine's multi-lobe analytic approximation of the CIE 1931 2° colour-matching
|
|
88
|
+
* functions at one wavelength (nm, standard-air wavelength as in the CIE tables). Approximation:
|
|
89
|
+
* see the module notes for the measured fit error. The values are non-negative over the domain.
|
|
90
|
+
*/
|
|
91
|
+
export declare function estimateCie1931ColorMatchingFunctions(wavelengthNanometers: number): CieXyzTristimulus;
|
|
92
|
+
/**
|
|
93
|
+
* Validates a colour-matching-function source once for repeated evaluation.
|
|
94
|
+
* Tabulated values may be signed only for `caller-defined` observers; CIE observers
|
|
95
|
+
* require non-negative values.
|
|
96
|
+
*/
|
|
97
|
+
export declare function prepareColorMatchingFunctions(source: ColorMatchingFunctionsSource): PreparedColorMatchingFunctions;
|
|
98
|
+
/** A validated spectrum ready for evaluation. */
|
|
99
|
+
export interface PreparedColorimetricSpectrum {
|
|
100
|
+
wavelengthRangeNanometers: SpectralWavelengthRangeNanometers;
|
|
101
|
+
evaluate(wavelengthNanometers: number): number;
|
|
102
|
+
}
|
|
103
|
+
/** Validates a tabulated or functional spectrum (values must be finite; sign is not restricted). */
|
|
104
|
+
export declare function prepareColorimetricSpectrum(spectrum: ColorimetricSpectrum, path?: string): PreparedColorimetricSpectrum;
|
|
105
|
+
export interface CreateColorimetricMidpointQuadratureInput {
|
|
106
|
+
wavelengthRangeNanometers: SpectralWavelengthRangeNanometers;
|
|
107
|
+
/** Hard upper bound on each midpoint subinterval width, nm. */
|
|
108
|
+
maximumSubintervalWidthNanometers: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Builds deterministic uniform midpoint wavelength nodes covering the range. Every
|
|
112
|
+
* node carries its d-lambda measure in nm; the measures sum to the range width.
|
|
113
|
+
*/
|
|
114
|
+
export declare function createColorimetricMidpointQuadrature(input: CreateColorimetricMidpointQuadratureInput): ColorimetricQuadratureNode[];
|
|
115
|
+
/** Validates explicit quadrature nodes (positive wavelengths and positive measures). */
|
|
116
|
+
export declare function parseColorimetricQuadratureNodes(nodes: unknown): ColorimetricQuadratureNode[];
|
|
117
|
+
/**
|
|
118
|
+
* Normalization of integrated tristimulus values.
|
|
119
|
+
* - `white-luminance-one`: k = 1 / Σ S ȳ Δλ, so the perfect reflecting diffuser (or the
|
|
120
|
+
* illuminant itself) has Y = 1 (relative colorimetry with Y scaled to 1; also CIE 15:2018).
|
|
121
|
+
* - `scale`: X = factor · Σ …; for example 683.002 lm/W with spectral radiance in
|
|
122
|
+
* W·m⁻²·sr⁻¹·nm⁻¹ yields luminance in cd/m² (the caller owns the unit semantics).
|
|
123
|
+
*/
|
|
124
|
+
export type TristimulusNormalization = {
|
|
125
|
+
kind: "white-luminance-one";
|
|
126
|
+
} | {
|
|
127
|
+
kind: "scale";
|
|
128
|
+
factor: number;
|
|
129
|
+
};
|
|
130
|
+
export interface IntegrateSpectrumToXyzInput {
|
|
131
|
+
quadratureNodes: readonly ColorimetricQuadratureNode[];
|
|
132
|
+
/** Illuminant SPD or emitted spectral radiance S(λ). */
|
|
133
|
+
spectralDistribution: ColorimetricSpectrum;
|
|
134
|
+
/** Optional spectral reflectance/transmittance factor R(λ); omitted means R = 1. */
|
|
135
|
+
spectralFactor?: ColorimetricSpectrum;
|
|
136
|
+
colorMatchingFunctions: ColorMatchingFunctionsSource;
|
|
137
|
+
normalization: TristimulusNormalization;
|
|
138
|
+
}
|
|
139
|
+
export interface IntegratedSpectrumXyz {
|
|
140
|
+
xyz: CieXyzTristimulus;
|
|
141
|
+
/** Tristimulus values of S(λ) alone under the same normalization (the adopted white). */
|
|
142
|
+
whiteXyz: CieXyzTristimulus;
|
|
143
|
+
chromaticity: CieXyChromaticity | null;
|
|
144
|
+
normalizationFactor: number;
|
|
145
|
+
observer: ColorimetricObserver;
|
|
146
|
+
nodeCount: number;
|
|
147
|
+
}
|
|
148
|
+
/** Internal: per-node weights S·Δλ and CMF values; reused by matrix fitting. */
|
|
149
|
+
export interface SampledColorimetricBasis {
|
|
150
|
+
nodes: readonly ColorimetricQuadratureNode[];
|
|
151
|
+
weights: Float64Array;
|
|
152
|
+
xBar: Float64Array;
|
|
153
|
+
yBar: Float64Array;
|
|
154
|
+
zBar: Float64Array;
|
|
155
|
+
cmf: PreparedColorMatchingFunctions;
|
|
156
|
+
}
|
|
157
|
+
export declare function sampleColorimetricBasis(quadratureNodes: readonly ColorimetricQuadratureNode[], spectralDistribution: PreparedColorimetricSpectrum, cmf: PreparedColorMatchingFunctions): SampledColorimetricBasis;
|
|
158
|
+
export declare function sampleFactor(basis: SampledColorimetricBasis, factor: PreparedColorimetricSpectrum | undefined): Float64Array;
|
|
159
|
+
export declare function integrateSampledXyz(basis: SampledColorimetricBasis, factor: Float64Array): CieXyzTristimulus;
|
|
160
|
+
export declare function resolveNormalizationFactor(normalization: TristimulusNormalization, unnormalizedWhiteY: number): number;
|
|
161
|
+
/**
|
|
162
|
+
* Integrates a spectrum (optionally multiplied by a reflectance/transmittance factor)
|
|
163
|
+
* against colour-matching functions with caller-explicit quadrature (the tristimulus integral of
|
|
164
|
+
* Wyman, Sloan & Shirley 2013, Eq. 1; also CIE 15:2018 §7).
|
|
165
|
+
* Provenance is `approximation` for the analytic CMF fit and `calculated` for
|
|
166
|
+
* caller-tabulated CMFs. Either way, the caller chooses the quadrature.
|
|
167
|
+
*/
|
|
168
|
+
export declare function integrateSpectrumToXyz(input: IntegrateSpectrumToXyzInput): CalculationResult<IntegratedSpectrumXyz>;
|