@photivra/engine 2.15.0 → 2.17.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 +102 -1
- package/CITATION.cff +1 -1
- package/README.md +6 -6
- package/SECURITY.md +1 -1
- package/THIRD_PARTY.md +38 -0
- package/dist/camera/lens-projection.d.ts +5 -0
- package/dist/camera/lens-projection.js +10 -0
- package/dist/camera/lens-projection.js.map +1 -1
- package/dist/capture/native-environment-lean.js +1 -1
- package/dist/capture/native-environment-lean.js.map +1 -1
- package/dist/capture/native-raw-development.d.ts +15 -0
- package/dist/capture/native-raw-development.js +12 -6
- package/dist/capture/native-raw-development.js.map +1 -1
- package/dist/capture/raw-development-kernel.d.ts +10 -3
- package/dist/capture/raw-development-kernel.js +25 -6
- package/dist/capture/raw-development-kernel.js.map +1 -1
- package/dist/core/internal-radiance-evaluator.d.ts +5 -2
- package/dist/core/internal-radiance-evaluator.js.map +1 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/core/version.js.map +1 -1
- package/dist/equipment/generic-lens-catalogue.d.ts +227 -0
- package/dist/equipment/generic-lens-catalogue.js +243 -0
- package/dist/equipment/generic-lens-catalogue.js.map +1 -0
- package/dist/facade/defocus-bokeh-zones.d.ts +33 -0
- package/dist/facade/defocus-bokeh-zones.js +53 -0
- package/dist/facade/defocus-bokeh-zones.js.map +1 -0
- package/dist/facade/defocus-image-space-provider.d.ts +118 -0
- package/dist/facade/defocus-image-space-provider.js +448 -0
- package/dist/facade/defocus-image-space-provider.js.map +1 -0
- package/dist/facade/diffraction-provider.d.ts +45 -0
- package/dist/facade/diffraction-provider.js +120 -14
- package/dist/facade/diffraction-provider.js.map +1 -1
- package/dist/facade/display-view-gpu-session.js +4 -0
- package/dist/facade/display-view-gpu-session.js.map +1 -1
- package/dist/facade/display-view-gpu.d.ts +10 -0
- package/dist/facade/display-view-gpu.js.map +1 -1
- package/dist/facade/display-view-lens-signal.d.ts +30 -0
- package/dist/facade/display-view-lens-signal.js +427 -0
- package/dist/facade/display-view-lens-signal.js.map +1 -0
- package/dist/facade/display-view.d.ts +21 -0
- package/dist/facade/display-view.js +66 -8
- package/dist/facade/display-view.js.map +1 -1
- package/dist/facade/expected-signal-setup.d.ts +7 -0
- package/dist/facade/expected-signal-setup.js +12 -2
- package/dist/facade/expected-signal-setup.js.map +1 -1
- package/dist/facade/expected-signal.d.ts +8 -0
- package/dist/facade/expected-signal.js +150 -0
- package/dist/facade/expected-signal.js.map +1 -1
- package/dist/facade/generic-lens-capture.d.ts +6 -0
- package/dist/facade/generic-lens-capture.js +8 -0
- package/dist/facade/generic-lens-capture.js.map +1 -0
- package/dist/facade/large-defocus-lattice.d.ts +39 -0
- package/dist/facade/large-defocus-lattice.js +64 -0
- package/dist/facade/large-defocus-lattice.js.map +1 -0
- package/dist/facade/scene-radiance.d.ts +5 -0
- package/dist/facade/scene-radiance.js +5 -2
- package/dist/facade/scene-radiance.js.map +1 -1
- package/dist/facade/simulate-capture.d.ts +148 -6
- package/dist/facade/simulate-capture.js +521 -88
- package/dist/facade/simulate-capture.js.map +1 -1
- package/dist/facade/simulate-display-view.js +29 -19
- package/dist/facade/simulate-display-view.js.map +1 -1
- package/dist/gpu/display-view-quality-gpu.d.ts +2 -9
- package/dist/gpu/display-view-quality-gpu.js +63 -13
- package/dist/gpu/display-view-quality-gpu.js.map +1 -1
- package/dist/gpu/display-view-speed-gpu.d.ts +2 -0
- package/dist/gpu/display-view-speed-gpu.js +47 -16
- package/dist/gpu/display-view-speed-gpu.js.map +1 -1
- package/dist/gpu/image-kernel-accelerator.js +3 -0
- package/dist/gpu/image-kernel-accelerator.js.map +1 -1
- package/dist/gpu/wgsl-display-view-quality-kernel.d.ts +4 -0
- package/dist/gpu/wgsl-display-view-quality-kernel.js +53 -2
- package/dist/gpu/wgsl-display-view-quality-kernel.js.map +1 -1
- package/dist/gpu/wgsl-display-view-speed-kernel.d.ts +15 -0
- package/dist/gpu/wgsl-display-view-speed-kernel.js +42 -1
- package/dist/gpu/wgsl-display-view-speed-kernel.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/optics/defocus-bokeh-kernel.d.ts +207 -0
- package/dist/optics/defocus-bokeh-kernel.js +380 -0
- package/dist/optics/defocus-bokeh-kernel.js.map +1 -0
- package/dist/optics/defocus-disc-kernel.d.ts +44 -21
- package/dist/optics/defocus-disc-kernel.js +47 -25
- package/dist/optics/defocus-disc-kernel.js.map +1 -1
- package/dist/optics/generic-lens-psf.d.ts +68 -0
- package/dist/optics/generic-lens-psf.js +337 -0
- package/dist/optics/generic-lens-psf.js.map +1 -0
- package/dist/optics/illumination-vignetting.d.ts +6 -0
- package/dist/optics/illumination-vignetting.js +24 -7
- package/dist/optics/illumination-vignetting.js.map +1 -1
- package/dist/optics/sensor-environment-query.d.ts +37 -0
- package/dist/optics/sensor-environment-query.js +58 -19
- package/dist/optics/sensor-environment-query.js.map +1 -1
- package/dist/optics/site-kernel-runs.d.ts +77 -0
- package/dist/optics/site-kernel-runs.js +200 -0
- package/dist/optics/site-kernel-runs.js.map +1 -0
- package/dist/output/generic-lens-corrections.d.ts +24 -0
- package/dist/output/generic-lens-corrections.js +51 -0
- package/dist/output/generic-lens-corrections.js.map +1 -0
- package/dist/processing/development-detail.d.ts +132 -0
- package/dist/processing/development-detail.js +325 -0
- package/dist/processing/development-detail.js.map +1 -0
- package/docs/AGENT_GUIDE.md +1 -0
- package/docs/API_REFERENCE.md +54 -1
- package/docs/QUICK_START.md +444 -26
- package/docs/USAGE.md +71 -8
- package/docs/api/capture-native-raw-development.md +16 -0
- package/docs/api/core-version.md +1 -1
- package/docs/api/equipment-generic-lens-catalogue.md +281 -0
- package/docs/api/exports.json +162 -2
- package/docs/api/facade-simulate-capture.md +151 -5
- package/docs/api/optics-defocus-bokeh-kernel.md +145 -0
- package/docs/api/optics-defocus-disc-kernel.md +25 -17
- package/docs/api/optics-sensor-environment-query.md +6 -0
- package/docs/api/output-generic-lens-corrections.md +39 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SiteKernelFieldZones } from "./diffraction-provider.js";
|
|
2
|
+
import { type DefocusBokehSiteKernel, type ResolvedDefocusBokehOptions } from "../optics/defocus-bokeh-kernel.js";
|
|
3
|
+
export interface DefocusBokehZonePlan {
|
|
4
|
+
zones: SiteKernelFieldZones;
|
|
5
|
+
/** Field tangent of each zone centre (output-image axes, +Y up), row-major. */
|
|
6
|
+
fields: readonly {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}[];
|
|
10
|
+
/** Smallest open-area ratio over the zone centres, and the largest change between two zones sharing an edge. */
|
|
11
|
+
minimumOpenAreaRatio: number;
|
|
12
|
+
largestAdjacentOpenAreaRatioChange: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Plans the zones. `fieldOf(x, y)` is the field tangent of native point (x, y) in sites from the raster's top-left corner;
|
|
16
|
+
* `kernelAt(field)` builds a zone's kernel (its radius at most `radius`). Kernels are built on first use by the gather.
|
|
17
|
+
*/
|
|
18
|
+
export declare function planDefocusBokehZones(input: {
|
|
19
|
+
options: ResolvedDefocusBokehOptions;
|
|
20
|
+
nativeWidth: number;
|
|
21
|
+
nativeHeight: number;
|
|
22
|
+
radius: number;
|
|
23
|
+
fNumber: number;
|
|
24
|
+
focalLengthMm: number;
|
|
25
|
+
fieldOf: (x: number, y: number) => {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
kernelAt: (field: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}) => DefocusBokehSiteKernel;
|
|
33
|
+
}): DefocusBokehZonePlan;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* `lens.defocus` with a cat's eye (#553): the field zones of the capture's field-varying defocus kernel. The native raster is
|
|
4
|
+
* cut into square zones (`fieldZonesAcrossLongSide` across its long side); each zone's kernel is the shaped kernel of the
|
|
5
|
+
* field point at the zone's centre (`createDefocusBokehSiteKernel`), padded to the axis kernel's radius (the cat's eye only
|
|
6
|
+
* removes light from the opening, so no zone's blur reaches further than the unclipped one). The gather
|
|
7
|
+
* (`createZonedGather`) gives every site its zone's kernel: a piecewise-constant approximation of the space-variant blur,
|
|
8
|
+
* whose step between neighbouring zones is reported (the largest change of the open-area ratio). Internal.
|
|
9
|
+
*/
|
|
10
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
11
|
+
import { openPupilAreaRatio } from "../optics/defocus-bokeh-kernel.js";
|
|
12
|
+
/**
|
|
13
|
+
* Plans the zones. `fieldOf(x, y)` is the field tangent of native point (x, y) in sites from the raster's top-left corner;
|
|
14
|
+
* `kernelAt(field)` builds a zone's kernel (its radius at most `radius`). Kernels are built on first use by the gather.
|
|
15
|
+
*/
|
|
16
|
+
export function planDefocusBokehZones(input) {
|
|
17
|
+
const { options, nativeWidth: W, nativeHeight: H, radius: R } = input;
|
|
18
|
+
const across = options.catsEye.fieldZonesAcrossLongSide, size = Math.ceil(Math.max(W, H) / across);
|
|
19
|
+
const columns = Math.ceil(W / size), rows = Math.ceil(H / size), fields = [], ratios = [];
|
|
20
|
+
for (let zy = 0; zy < rows; zy++)
|
|
21
|
+
for (let zx = 0; zx < columns; zx++) {
|
|
22
|
+
const field = input.fieldOf((zx * size + Math.min(W, (zx + 1) * size)) / 2, (zy * size + Math.min(H, (zy + 1) * size)) / 2);
|
|
23
|
+
fields.push(field);
|
|
24
|
+
ratios.push(openPupilAreaRatio(options, input.fNumber, input.focalLengthMm, field));
|
|
25
|
+
}
|
|
26
|
+
let minimum = Infinity, step = 0;
|
|
27
|
+
for (let zy = 0; zy < rows; zy++)
|
|
28
|
+
for (let zx = 0; zx < columns; zx++) {
|
|
29
|
+
const r = ratios[zy * columns + zx];
|
|
30
|
+
minimum = Math.min(minimum, r);
|
|
31
|
+
if (zx + 1 < columns)
|
|
32
|
+
step = Math.max(step, Math.abs(r - ratios[zy * columns + zx + 1]));
|
|
33
|
+
if (zy + 1 < rows)
|
|
34
|
+
step = Math.max(step, Math.abs(r - ratios[(zy + 1) * columns + zx]));
|
|
35
|
+
}
|
|
36
|
+
const width = 2 * R + 1;
|
|
37
|
+
return {
|
|
38
|
+
fields, minimumOpenAreaRatio: minimum, largestAdjacentOpenAreaRatioChange: step,
|
|
39
|
+
zones: { size, columns, rows, kernelOf(zone) {
|
|
40
|
+
const k = input.kernelAt(fields[zone]);
|
|
41
|
+
if (k.radius === R)
|
|
42
|
+
return k.weights;
|
|
43
|
+
if (k.radius > R)
|
|
44
|
+
throw new InvalidConfigurationError("lens.defocus: a cat's-eye zone kernel reaches beyond the unclipped kernel's radius.");
|
|
45
|
+
const padded = new Float64Array(width * width), offset = R - k.radius;
|
|
46
|
+
for (let j = 0; j < k.width; j++)
|
|
47
|
+
for (let i = 0; i < k.width; i++)
|
|
48
|
+
padded[(j + offset) * width + i + offset] = k.weights[j * k.width + i];
|
|
49
|
+
return padded;
|
|
50
|
+
} }
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=defocus-bokeh-zones.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defocus-bokeh-zones.js","sourceRoot":"","sources":["../../src/facade/defocus-bokeh-zones.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;GAOG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAiE,MAAM,mCAAmC,CAAC;AAWtI;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KACwI;IAC5K,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,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CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;gBACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE;oBAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE;wBAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;gBAC5I,OAAO,MAAM,CAAC;YAChB,CAAC,EAAE;KACJ,CAAC;AACJ,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * `lens.defocus` with a cat's eye (#553): the field zones of the capture's field-varying defocus kernel. The native raster is\n * cut into square zones (`fieldZonesAcrossLongSide` across its long side); each zone's kernel is the shaped kernel of the\n * field point at the zone's centre (`createDefocusBokehSiteKernel`), padded to the axis kernel's radius (the cat's eye only\n * removes light from the opening, so no zone's blur reaches further than the unclipped one). The gather\n * (`createZonedGather`) gives every site its zone's kernel: a piecewise-constant approximation of the space-variant blur,\n * whose step between neighbouring zones is reported (the largest change of the open-area ratio). Internal.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport type { SiteKernelFieldZones } from \"./diffraction-provider.js\";\nimport { openPupilAreaRatio, type DefocusBokehSiteKernel, type ResolvedDefocusBokehOptions } from \"../optics/defocus-bokeh-kernel.js\";\n\nexport interface DefocusBokehZonePlan {\n zones: SiteKernelFieldZones;\n /** Field tangent of each zone centre (output-image axes, +Y up), row-major. */\n fields: readonly { x: number; y: number }[];\n /** Smallest open-area ratio over the zone centres, and the largest change between two zones sharing an edge. */\n minimumOpenAreaRatio: number;\n largestAdjacentOpenAreaRatioChange: number;\n}\n\n/**\n * Plans the zones. `fieldOf(x, y)` is the field tangent of native point (x, y) in sites from the raster's top-left corner;\n * `kernelAt(field)` builds a zone's kernel (its radius at most `radius`). Kernels are built on first use by the gather.\n */\nexport function planDefocusBokehZones(input: { options: ResolvedDefocusBokehOptions; nativeWidth: number; nativeHeight: number; radius: number;\n fNumber: number; focalLengthMm: number; fieldOf: (x: number, y: number) => { x: number; y: number }; kernelAt: (field: { x: number; y: number }) => DefocusBokehSiteKernel }): DefocusBokehZonePlan {\n const { options, nativeWidth: W, nativeHeight: H, radius: R } = input;\n const across = options.catsEye!.fieldZonesAcrossLongSide, size = Math.ceil(Math.max(W, H) / across);\n const columns = Math.ceil(W / size), rows = Math.ceil(H / size), fields: { x: number; y: number }[] = [], ratios: number[] = [];\n for (let zy = 0; zy < rows; zy++) for (let zx = 0; zx < columns; zx++) {\n const field = input.fieldOf((zx * size + Math.min(W, (zx + 1) * size)) / 2, (zy * size + Math.min(H, (zy + 1) * size)) / 2);\n fields.push(field);\n ratios.push(openPupilAreaRatio(options, input.fNumber, input.focalLengthMm, field));\n }\n let minimum = Infinity, step = 0;\n for (let zy = 0; zy < rows; zy++) for (let zx = 0; zx < columns; zx++) {\n const r = ratios[zy * columns + zx]!;\n minimum = Math.min(minimum, r);\n if (zx + 1 < columns) step = Math.max(step, Math.abs(r - ratios[zy * columns + zx + 1]!));\n if (zy + 1 < rows) step = Math.max(step, Math.abs(r - ratios[(zy + 1) * columns + zx]!));\n }\n const width = 2 * R + 1;\n return {\n fields, minimumOpenAreaRatio: minimum, largestAdjacentOpenAreaRatioChange: step,\n zones: { size, columns, rows, kernelOf(zone: number): Float64Array {\n const k = input.kernelAt(fields[zone]!);\n if (k.radius === R) return k.weights;\n if (k.radius > R) throw new InvalidConfigurationError(\"lens.defocus: a cat's-eye zone kernel reaches beyond the unclipped kernel's radius.\");\n const padded = new Float64Array(width * width), offset = R - k.radius;\n for (let j = 0; j < k.width; j++) for (let i = 0; i < k.width; i++) padded[(j + offset) * width + i + offset] = k.weights[j * k.width + i]!;\n return padded;\n } }\n };\n}\n"]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type CameraAngularVelocityRadPerSec } from "../motion/camera-rotation.js";
|
|
2
|
+
import { type IlluminationVignettingProfile } from "../optics/illumination-vignetting.js";
|
|
3
|
+
import { type PreparedEnvironmentLensFieldMapping } from "../optics/sensor-environment-query.js";
|
|
4
|
+
import { type SiteKernelFieldZones } from "./diffraction-provider.js";
|
|
5
|
+
import type { PlanarSceneRadianceProvider } from "./scene-radiance.js";
|
|
6
|
+
import { type LargeDefocusKernel } from "./large-defocus-lattice.js";
|
|
7
|
+
/** The camera geometry the environment uses for each site query (the same options as the site inputs). */
|
|
8
|
+
export interface DefocusImageSpaceGeometry {
|
|
9
|
+
focalLengthMm: number;
|
|
10
|
+
focusDistanceM: number;
|
|
11
|
+
angularVelocityRadPerSec: CameraAngularVelocityRadPerSec;
|
|
12
|
+
/** The site inputs' `lensFieldMapping`, prepared; omitted for the ideal rectilinear, distortion-free mapping. */
|
|
13
|
+
lensMapping?: PreparedEnvironmentLensFieldMapping;
|
|
14
|
+
/** The site inputs' radial-illumination-vignetting profile; omitted for unity field throughput. */
|
|
15
|
+
vignetting?: IlluminationVignettingProfile;
|
|
16
|
+
}
|
|
17
|
+
/** Internal: the scene ray and field factor of sensor points, and the sensor point of a scene ray, for one geometry. */
|
|
18
|
+
export interface PreparedDefocusImageSpaceGeometry {
|
|
19
|
+
/**
|
|
20
|
+
* The unit look direction (toward the scene, reference camera axes at exposure start) of native sensor point (x, y) mm
|
|
21
|
+
* (+X right, +Y down) at time t, and its field factor F = T·A (vignetting throughput × distortion area factor).
|
|
22
|
+
*/
|
|
23
|
+
lookOf(xMm: number, yMm: number, timeSeconds: number): {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
z: number;
|
|
27
|
+
factor: number;
|
|
28
|
+
};
|
|
29
|
+
/** The native sensor point (mm, +Y down) whose scene ray at time t is the look direction; undefined outside the mapping. */
|
|
30
|
+
sensorPointOf(look: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
z: number;
|
|
34
|
+
}, timeSeconds: number): {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} | undefined;
|
|
38
|
+
/** True with camera rotation: the ray of a sensor point depends on time. */
|
|
39
|
+
timeDependent: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Internal: prepares {@link PreparedDefocusImageSpaceGeometry} with the environment's own conventions and arithmetic. */
|
|
42
|
+
export declare function prepareDefocusImageSpaceGeometry(geometry: DefocusImageSpaceGeometry): PreparedDefocusImageSpaceGeometry;
|
|
43
|
+
export interface DefocusImageSpaceProviderInput {
|
|
44
|
+
base: PlanarSceneRadianceProvider;
|
|
45
|
+
geometry: PreparedDefocusImageSpaceGeometry;
|
|
46
|
+
/** Each spectral node's kernel on the site lattice, (2·kernelRadius + 1)² taps, row-major (the disc, or diffraction ⊛ disc). */
|
|
47
|
+
siteKernels: (wavelengthNm: number) => Float64Array;
|
|
48
|
+
wavelengthsNm: readonly number[];
|
|
49
|
+
kernelRadius: number;
|
|
50
|
+
nativeWidth: number;
|
|
51
|
+
nativeHeight: number;
|
|
52
|
+
sitePitchMicrometers: number;
|
|
53
|
+
/** Planar geometry of the base provider (plane distance and frame-unit scale), to find the plane point of a ray as it does. */
|
|
54
|
+
distanceM: number;
|
|
55
|
+
metresPerFrameUnit: number;
|
|
56
|
+
/** Offsets of the query points from the site centres, in sites (+x right, +y down). Default: one zero offset. */
|
|
57
|
+
queryOffsetsSites?: readonly {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
}[];
|
|
61
|
+
/** Region renders: the native sites that will be queried. Values are bit-identical to the whole render's. Default: the whole raster. */
|
|
62
|
+
window?: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
/** Most distinct request times kept per band (the temporal sample count). Default 1. */
|
|
69
|
+
timesPerBand?: number;
|
|
70
|
+
/** Called with the duration in ms of each band convolution (diagnostics only). */
|
|
71
|
+
onConvolution?: (milliseconds: number) => void;
|
|
72
|
+
/**
|
|
73
|
+
* #564: a defocus kernel above the direct radius, convolved by runs in fixed tiles (`large-defocus-lattice.ts`), with each
|
|
74
|
+
* node's diffraction kernel after it; used instead of `siteKernels` (`kernelRadius` is then unused).
|
|
75
|
+
*/
|
|
76
|
+
largeKernel?: LargeDefocusKernel;
|
|
77
|
+
/** #553: a field-varying kernel by zones (the cat's eye of lens.defocus), gathered instead of `siteKernels`, the same at every node. */
|
|
78
|
+
fieldZones?: SiteKernelFieldZones;
|
|
79
|
+
}
|
|
80
|
+
/** Internal (not exported from the package): the base provider with the defocus disc applied in image space (#548). */
|
|
81
|
+
export declare function createDefocusImageSpaceProvider(input: DefocusImageSpaceProviderInput): PlanarSceneRadianceProvider;
|
|
82
|
+
/** Field-variation bounds of the image-space disc for one request (#548), recorded in the `lens.defocus` assumption. */
|
|
83
|
+
export interface DefocusFieldVariation {
|
|
84
|
+
/** Sensor points the bounds were evaluated at: a grid of this many points per side over the native raster, edges included. */
|
|
85
|
+
gridPointsPerSide: number;
|
|
86
|
+
/**
|
|
87
|
+
* Camera rotation (pitch or yaw tilts the scene plane in the camera frame): the largest change of the disc diameter, in
|
|
88
|
+
* sites, between the axial depth of each scene point in the rotated camera frame and the subject distance, over the grid and
|
|
89
|
+
* the rendered temporal midpoints. 0 for roll only; null without rotation.
|
|
90
|
+
*/
|
|
91
|
+
rotationMaximumDiameterChangeSites: number | null;
|
|
92
|
+
/**
|
|
93
|
+
* Distortion: the largest deviation from 1 of the local scale of the distortion map (singular values of d distorted / d ideal)
|
|
94
|
+
* over the grid: the relative disc-size difference to a model that blurs the ideal image and then distorts it. Null without distortion.
|
|
95
|
+
*/
|
|
96
|
+
distortionMaximumLocalScaleDeviation: number | null;
|
|
97
|
+
/**
|
|
98
|
+
* A non-rectilinear projection: the largest change of the disc diameter, in sites, between the distance along each scene
|
|
99
|
+
* point's ray and its axial depth (the thin-lens model uses the axial depth). Null for the rectilinear projection.
|
|
100
|
+
*/
|
|
101
|
+
projectionMaximumDiameterChangeSites: number | null;
|
|
102
|
+
}
|
|
103
|
+
/** Internal: {@link DefocusFieldVariation} on a 9 × 9 grid of sensor points (the extremes of these smooth maps lie on the frame's edges). */
|
|
104
|
+
export declare function calculateDefocusFieldVariation(input: {
|
|
105
|
+
geometry: PreparedDefocusImageSpaceGeometry;
|
|
106
|
+
lensMapping?: PreparedEnvironmentLensFieldMapping;
|
|
107
|
+
focalLengthMm: number;
|
|
108
|
+
fNumber: number;
|
|
109
|
+
focusDistanceM: number;
|
|
110
|
+
subjectDistanceM: number;
|
|
111
|
+
pitchMicrometers: number;
|
|
112
|
+
nativeWidth: number;
|
|
113
|
+
nativeHeight: number;
|
|
114
|
+
angularVelocityRadPerSec: CameraAngularVelocityRadPerSec;
|
|
115
|
+
temporalMidpointsSeconds: readonly number[];
|
|
116
|
+
diameterSites: number;
|
|
117
|
+
discAt: (subjectDistanceM: number) => number;
|
|
118
|
+
}): DefocusFieldVariation;
|