@photivra/engine 2.2.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -1
- package/CITATION.cff +1 -1
- package/README.md +6 -6
- package/SECURITY.md +1 -1
- package/dist/capture/native-environment-raw.d.ts +18 -0
- package/dist/capture/native-environment-raw.js +17 -1
- package/dist/capture/native-environment-raw.js.map +1 -1
- package/dist/capture/native-raw-dng.d.ts +3 -0
- package/dist/capture/native-raw-dng.js +23 -3
- package/dist/capture/native-raw-dng.js.map +1 -1
- package/dist/capture/native-raw.d.ts +3 -0
- package/dist/capture/native-raw.js +8 -5
- package/dist/capture/native-raw.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-prime-lenses.d.ts +46 -0
- package/dist/equipment/generic-prime-lenses.js +59 -0
- package/dist/equipment/generic-prime-lenses.js.map +1 -0
- package/dist/facade/chart-scenes.d.ts +270 -1
- package/dist/facade/chart-scenes.js +443 -17
- package/dist/facade/chart-scenes.js.map +1 -1
- package/dist/facade/scene-radiance.d.ts +47 -0
- package/dist/facade/scene-radiance.js +65 -5
- package/dist/facade/scene-radiance.js.map +1 -1
- package/dist/facade/simulate-capture.d.ts +158 -4
- package/dist/facade/simulate-capture.js +324 -56
- package/dist/facade/simulate-capture.js.map +1 -1
- package/dist/facade/subject-framing.d.ts +55 -0
- package/dist/facade/subject-framing.js +66 -0
- package/dist/facade/subject-framing.js.map +1 -0
- package/dist/gpu/chart-radiance-gpu.d.ts +8 -0
- package/dist/gpu/chart-radiance-gpu.js +20 -1
- package/dist/gpu/chart-radiance-gpu.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/output/text-metadata.d.ts +32 -0
- package/dist/output/text-metadata.js +201 -0
- package/dist/output/text-metadata.js.map +1 -0
- package/docs/API_REFERENCE.md +56 -1
- package/docs/QUICK_START.md +325 -4
- package/docs/api/capture-native-raw-dng.md +2 -0
- package/docs/api/core-version.md +1 -1
- package/docs/api/equipment-generic-prime-lenses.md +85 -0
- package/docs/api/exports.json +172 -2
- package/docs/api/facade-chart-scenes.md +280 -4
- package/docs/api/facade-scene-radiance.md +42 -0
- package/docs/api/facade-simulate-capture.md +113 -2
- package/docs/api/facade-subject-framing.md +72 -0
- package/docs/api/output-text-metadata.md +20 -0
- package/package.json +1 -1
|
@@ -24,6 +24,13 @@ export interface SiemensStarChartScene {
|
|
|
24
24
|
lightReflectance?: number;
|
|
25
25
|
/** Reflectance outside the star. Default 0.18. */
|
|
26
26
|
backgroundReflectance?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 2.3: angular reflectance profile. `bar` (default): square-wave sectors. `sine`: a sinusoidal star,
|
|
29
|
+
* R(θ) = mid + amp·sin(2π·cycles·(θ/2π + ½)) between the dark and light reflectances, zero crossings at
|
|
30
|
+
* the bar star's sector edges, quantized to {@link CHART_CONTINUOUS_LEVELS} levels. Reported in the
|
|
31
|
+
* parameters only when given, so 2.2 scene digests are unchanged.
|
|
32
|
+
*/
|
|
33
|
+
profile?: "bar" | "sine";
|
|
27
34
|
}
|
|
28
35
|
export interface StepWedgeChartScene {
|
|
29
36
|
preset: "step-wedge";
|
|
@@ -70,9 +77,146 @@ export interface PatchChartScene {
|
|
|
70
77
|
gapFraction?: number;
|
|
71
78
|
backgroundReflectance?: number;
|
|
72
79
|
}
|
|
73
|
-
|
|
80
|
+
/**
|
|
81
|
+
* 2.3: seeded dead-leaves texture (Matheron's random closed set model, in the scale-invariant form used for
|
|
82
|
+
* camera texture measurement by Cao, Guichard and Hornung): opaque disks with Poisson-distributed centres,
|
|
83
|
+
* radius density ∝ r⁻³ on [radiusMinimum, radiusMaximum] and a grey drawn uniformly in [minimum, maximum]
|
|
84
|
+
* reflectance. Disks are drawn in order with earlier disks on top until every point of the chart (plus 0.1
|
|
85
|
+
* frame units around it) is covered, which samples the stationary dead-leaves image exactly (Kendall and
|
|
86
|
+
* Thönnes' backward "perfect simulation"). Radii are in frame units (fraction of the frame half-width).
|
|
87
|
+
*/
|
|
88
|
+
export interface DeadLeavesChartScene {
|
|
89
|
+
preset: "dead-leaves";
|
|
90
|
+
/** Smallest disk radius, frame units, [0.002, radiusMaximum). Default 0.01. */
|
|
91
|
+
radiusMinimum?: number;
|
|
92
|
+
/** Largest disk radius, frame units, (radiusMinimum, 2]. Default 0.5. */
|
|
93
|
+
radiusMaximum?: number;
|
|
94
|
+
/** Grey range (neutral reflectances). Defaults 0.2 and 0.6. */
|
|
95
|
+
minimumReflectance?: number;
|
|
96
|
+
maximumReflectance?: number;
|
|
97
|
+
/** Random seed (uint32); the same seed gives the same disks on every platform. Default 1. */
|
|
98
|
+
seed?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 2.3: groups of three dark bars on a light plate (the three-bar concept of the US Air Force 1951 target,
|
|
102
|
+
* a US-government publication, in the engine's own arrangement): one group per frequency, vertical bars (horizontal resolution)
|
|
103
|
+
* in the upper row and horizontal bars (vertical resolution) below, optionally labelled with engine-drawn
|
|
104
|
+
* seven-segment numerals. Frequencies are line widths per picture height (LW/PH, as in ISO 12233), where
|
|
105
|
+
* the picture height is the chart's height: one bar is PH/LW wide.
|
|
106
|
+
*/
|
|
107
|
+
export interface BarGroupsChartScene {
|
|
108
|
+
preset: "bar-groups";
|
|
109
|
+
/** One group per entry, left to right: integers 1..100000. Default [100, 200, 400, 800]. 1..32 entries. */
|
|
110
|
+
lineWidthsPerPictureHeight?: readonly number[];
|
|
111
|
+
/** Draw each group's LW/PH value below it. Default true. */
|
|
112
|
+
numerals?: boolean;
|
|
113
|
+
darkReflectance?: number;
|
|
114
|
+
lightReflectance?: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 2.3: hyperbolic wedge: `lineCount` dark lines separated by light gaps of the same width, whose width
|
|
118
|
+
* shrinks along the wedge axis so that the frequency rises linearly from the minimum to the maximum LW/PH.
|
|
119
|
+
* The line edges are hyperbolas. `horizontal`: the axis runs left to right and the lines are nearly
|
|
120
|
+
* horizontal (vertical resolution); `vertical`: the axis runs bottom to top (horizontal resolution).
|
|
121
|
+
*/
|
|
122
|
+
export interface HyperbolicWedgeChartScene {
|
|
123
|
+
preset: "hyperbolic-wedge";
|
|
124
|
+
orientation?: "horizontal" | "vertical";
|
|
125
|
+
/** Dark lines, 1..50. Default 5. */
|
|
126
|
+
lineCount?: number;
|
|
127
|
+
/** LW/PH at the start and end of the axis. Defaults 100 and 1000. */
|
|
128
|
+
minimumLineWidthsPerPictureHeight?: number;
|
|
129
|
+
maximumLineWidthsPerPictureHeight?: number;
|
|
130
|
+
darkReflectance?: number;
|
|
131
|
+
lightReflectance?: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 2.3: circular zone plate R(r) = mid + amp·cos(π·k·r²): the local frequency k·r rises linearly from 0 at
|
|
135
|
+
* the centre to `maximumCyclesPerPictureHeight` at the rim (the quadratic-phase chirp of a Fresnel zone
|
|
136
|
+
* plate). Quantized to {@link CHART_CONTINUOUS_LEVELS} levels.
|
|
137
|
+
*/
|
|
138
|
+
export interface ZonePlateChartScene {
|
|
139
|
+
preset: "zone-plate";
|
|
140
|
+
/** Plate radius as a fraction of the frame half-height, (0, 1]. Default 0.9. */
|
|
141
|
+
radiusFraction?: number;
|
|
142
|
+
/** Frequency at the rim, cycles per picture height. Default 200. */
|
|
143
|
+
maximumCyclesPerPictureHeight?: number;
|
|
144
|
+
darkReflectance?: number;
|
|
145
|
+
lightReflectance?: number;
|
|
146
|
+
backgroundReflectance?: number;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 2.3: a field of dark squares rotated clockwise by `angleDegrees` on a light background, one centred in
|
|
150
|
+
* each of columns × rows equal cells: every square gives two near-vertical and two near-horizontal slanted
|
|
151
|
+
* edges (Burns, PICS 2000). See {@link calculateSlantedSquareEdges}.
|
|
152
|
+
*/
|
|
153
|
+
export interface SlantedSquaresChartScene {
|
|
154
|
+
preset: "slanted-squares";
|
|
155
|
+
columns?: number;
|
|
156
|
+
rows?: number;
|
|
157
|
+
/** Square side as a fraction of the smaller cell side, (0, 1); the rotated square must stay in its cell. Default 0.5. */
|
|
158
|
+
sizeFraction?: number;
|
|
159
|
+
/** Clockwise rotation, degrees, in (-45, 45). Default 5. */
|
|
160
|
+
angleDegrees?: number;
|
|
161
|
+
/** Square (dark) and background (light) reflectances. Defaults 0.15 and 0.6 (4:1). */
|
|
162
|
+
darkReflectance?: number;
|
|
163
|
+
lightReflectance?: number;
|
|
164
|
+
}
|
|
165
|
+
/** 2.3: straight lines at every multiple of `spacing` from the centre in u and v (a distortion and registration grid). */
|
|
166
|
+
export interface LineGridChartScene {
|
|
167
|
+
preset: "line-grid";
|
|
168
|
+
/** Distance between lines, frame units, (0, 2]. Default 1/3 (six cells across). */
|
|
169
|
+
spacing?: number;
|
|
170
|
+
/** Line width, frame units, (0, spacing). Default 0.01. */
|
|
171
|
+
lineWidth?: number;
|
|
172
|
+
lineReflectance?: number;
|
|
173
|
+
backgroundReflectance?: number;
|
|
174
|
+
}
|
|
175
|
+
/** 2.3: registration fiducial: a 2 × 2 checker disk inside a dark ring; `inverted` swaps the checker phase (an orientation cue). */
|
|
176
|
+
export interface FiducialChartScene {
|
|
177
|
+
preset: "fiducial";
|
|
178
|
+
/** Disk radius as a fraction of the frame half-height, (0, 1]. Default 0.8. */
|
|
179
|
+
radiusFraction?: number;
|
|
180
|
+
/** Ring width as a fraction of the radius, (0, 1). Default 0.18. */
|
|
181
|
+
ringFraction?: number;
|
|
182
|
+
/** Default false: the upper-right and lower-left quadrants are dark. */
|
|
183
|
+
inverted?: boolean;
|
|
184
|
+
darkReflectance?: number;
|
|
185
|
+
lightReflectance?: number;
|
|
186
|
+
backgroundReflectance?: number;
|
|
187
|
+
}
|
|
188
|
+
/** Any chart preset except `composite`: a composite's background or element. */
|
|
189
|
+
export type ChartElementScene = UniformChartScene | SlantedEdgeChartScene | SiemensStarChartScene | StepWedgeChartScene | GreyRampChartScene | CheckerboardChartScene | PointGridChartScene | PatchChartScene | DeadLeavesChartScene | BarGroupsChartScene | HyperbolicWedgeChartScene | ZonePlateChartScene | SlantedSquaresChartScene | LineGridChartScene | FiducialChartScene;
|
|
190
|
+
/**
|
|
191
|
+
* One element of a composite chart: a preset drawn inside its placement rectangle (frame units of the
|
|
192
|
+
* composite). The element sees its own frame: u = ±1 at the rectangle's left and right edges, aspect =
|
|
193
|
+
* height / width, and LW/PH frequencies still refer to the composite's picture height.
|
|
194
|
+
*/
|
|
195
|
+
export interface CompositeChartElement {
|
|
196
|
+
scene: ChartElementScene;
|
|
197
|
+
centerU: number;
|
|
198
|
+
centerV: number;
|
|
199
|
+
width: number;
|
|
200
|
+
height: number;
|
|
201
|
+
/** `rectangle` (default) or `ellipse` inscribed in the rectangle; outside it, earlier elements or the background show. */
|
|
202
|
+
mask?: "rectangle" | "ellipse";
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* 2.3: an ordered list of elements over a background. Later elements cover earlier ones. The engine
|
|
206
|
+
* provides only the generic parts; a branded or product-specific layout stays in the application.
|
|
207
|
+
*/
|
|
208
|
+
export interface CompositeChartScene {
|
|
209
|
+
preset: "composite";
|
|
210
|
+
/** Fills the whole composite frame. Default `{ preset: "uniform", reflectance: 0.18 }`. */
|
|
211
|
+
background?: ChartElementScene;
|
|
212
|
+
/** 1..256 elements, drawn in order. */
|
|
213
|
+
elements: readonly CompositeChartElement[];
|
|
214
|
+
}
|
|
215
|
+
export type ChartScene = ChartElementScene | CompositeChartScene;
|
|
74
216
|
export type ChartScenePresetId = ChartScene["preset"];
|
|
75
217
|
export declare const CHART_SCENE_PRESETS: readonly ChartScenePresetId[];
|
|
218
|
+
/** Neutral levels that represent a continuous pattern (grey ramp; 2.3 sine star, zone plate and dead-leaves greys). */
|
|
219
|
+
export declare const CHART_CONTINUOUS_LEVELS = 1024;
|
|
76
220
|
/** Engine-chosen chart parameters, each reported when the caller omitted it. */
|
|
77
221
|
export declare const CHART_SCENE_DEFAULTS: Readonly<{
|
|
78
222
|
uniform: Readonly<{
|
|
@@ -116,6 +260,62 @@ export declare const CHART_SCENE_DEFAULTS: Readonly<{
|
|
|
116
260
|
gapFraction: 0.1;
|
|
117
261
|
backgroundReflectance: 0.18;
|
|
118
262
|
}>;
|
|
263
|
+
"dead-leaves": Readonly<{
|
|
264
|
+
radiusMinimum: 0.01;
|
|
265
|
+
radiusMaximum: 0.5;
|
|
266
|
+
minimumReflectance: 0.2;
|
|
267
|
+
maximumReflectance: 0.6;
|
|
268
|
+
seed: 1;
|
|
269
|
+
}>;
|
|
270
|
+
"bar-groups": Readonly<{
|
|
271
|
+
lineWidthsPerPictureHeight: readonly number[];
|
|
272
|
+
numerals: true;
|
|
273
|
+
darkReflectance: 0.05;
|
|
274
|
+
lightReflectance: 0.8;
|
|
275
|
+
}>;
|
|
276
|
+
"hyperbolic-wedge": Readonly<{
|
|
277
|
+
orientation: "horizontal";
|
|
278
|
+
lineCount: 5;
|
|
279
|
+
minimumLineWidthsPerPictureHeight: 100;
|
|
280
|
+
maximumLineWidthsPerPictureHeight: 1000;
|
|
281
|
+
darkReflectance: 0.05;
|
|
282
|
+
lightReflectance: 0.8;
|
|
283
|
+
}>;
|
|
284
|
+
"zone-plate": Readonly<{
|
|
285
|
+
radiusFraction: 0.9;
|
|
286
|
+
maximumCyclesPerPictureHeight: 200;
|
|
287
|
+
darkReflectance: 0.1;
|
|
288
|
+
lightReflectance: 0.7;
|
|
289
|
+
backgroundReflectance: 0.18;
|
|
290
|
+
}>;
|
|
291
|
+
"slanted-squares": Readonly<{
|
|
292
|
+
columns: 3;
|
|
293
|
+
rows: 2;
|
|
294
|
+
sizeFraction: 0.5;
|
|
295
|
+
angleDegrees: 5;
|
|
296
|
+
darkReflectance: 0.15;
|
|
297
|
+
lightReflectance: 0.6;
|
|
298
|
+
}>;
|
|
299
|
+
"line-grid": Readonly<{
|
|
300
|
+
spacing: number;
|
|
301
|
+
lineWidth: 0.01;
|
|
302
|
+
lineReflectance: 0.42;
|
|
303
|
+
backgroundReflectance: 0.6;
|
|
304
|
+
}>;
|
|
305
|
+
fiducial: Readonly<{
|
|
306
|
+
radiusFraction: 0.8;
|
|
307
|
+
ringFraction: 0.18;
|
|
308
|
+
inverted: false;
|
|
309
|
+
darkReflectance: 0.05;
|
|
310
|
+
lightReflectance: 0.8;
|
|
311
|
+
backgroundReflectance: 0.18;
|
|
312
|
+
}>;
|
|
313
|
+
composite: Readonly<{
|
|
314
|
+
background: Readonly<{
|
|
315
|
+
preset: "uniform";
|
|
316
|
+
reflectance: 0.18;
|
|
317
|
+
}>;
|
|
318
|
+
}>;
|
|
119
319
|
}>;
|
|
120
320
|
/** A validated chart: every parameter resolved, plus which ones came from {@link CHART_SCENE_DEFAULTS}. */
|
|
121
321
|
export interface ResolvedChartScene {
|
|
@@ -148,6 +348,11 @@ export declare const CHART_SPECTRAL_RANGE_NANOMETERS: Readonly<{
|
|
|
148
348
|
minimum: 380;
|
|
149
349
|
maximum: 780;
|
|
150
350
|
}>;
|
|
351
|
+
/**
|
|
352
|
+
* Internal (not exported from the package): the caller input behind each material of a resolved chart, in
|
|
353
|
+
* material order (`undefined` for an engine neutral). The facade hashes caller spectra from these inputs.
|
|
354
|
+
*/
|
|
355
|
+
export declare function chartMaterialInputs(chart: ResolvedChartScene): readonly unknown[];
|
|
151
356
|
/**
|
|
152
357
|
* Validates a chart description and resolves every default. `aspect` is the frame height/width. Unknown
|
|
153
358
|
* fields are rejected so that a mistyped parameter never silently falls back to a default.
|
|
@@ -156,6 +361,70 @@ export declare function resolveChartScene(input: {
|
|
|
156
361
|
scene: ChartScene;
|
|
157
362
|
aspect: number;
|
|
158
363
|
}): ResolvedChartScene;
|
|
364
|
+
/** An axis-aligned rectangle in chart frame units: u0 ≤ u ≤ u1, v0 ≤ v ≤ v1. */
|
|
365
|
+
export interface ChartRectangle {
|
|
366
|
+
u0: number;
|
|
367
|
+
v0: number;
|
|
368
|
+
u1: number;
|
|
369
|
+
v1: number;
|
|
370
|
+
}
|
|
371
|
+
/** One bar group of a `bar-groups` chart or composite element, in the chart's frame units. */
|
|
372
|
+
export interface ChartBarGroupTarget {
|
|
373
|
+
/** Composite element index, or null for a plain `bar-groups` chart. */
|
|
374
|
+
elementIndex: number | null;
|
|
375
|
+
lineWidthsPerPictureHeight: number;
|
|
376
|
+
/** Line pairs (cycles) per picture height: LW/PH ÷ 2. */
|
|
377
|
+
cyclesPerPictureHeight: number;
|
|
378
|
+
/** Width of one bar, frame units. */
|
|
379
|
+
lineWidth: number;
|
|
380
|
+
/** The three vertical bars (horizontal resolution) and the three horizontal bars (vertical resolution). */
|
|
381
|
+
verticalBars: ChartRectangle;
|
|
382
|
+
horizontalBars: ChartRectangle;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* The bar groups of a `bar-groups` chart, or of every `bar-groups` element of a composite, in the chart's
|
|
386
|
+
* frame units (2.3). `aspect` is the chart's height / width, as for {@link resolveChartScene}.
|
|
387
|
+
*/
|
|
388
|
+
export declare function calculateBarGroupTargets(input: {
|
|
389
|
+
scene: ChartScene;
|
|
390
|
+
aspect: number;
|
|
391
|
+
}): ChartBarGroupTarget[];
|
|
392
|
+
/** One square of a `slanted-squares` chart and its four edges, in the chart's frame units. */
|
|
393
|
+
export interface ChartSlantedSquare {
|
|
394
|
+
elementIndex: number | null;
|
|
395
|
+
center: {
|
|
396
|
+
u: number;
|
|
397
|
+
v: number;
|
|
398
|
+
};
|
|
399
|
+
/** Side length, frame units. */
|
|
400
|
+
side: number;
|
|
401
|
+
/** Clockwise rotation, degrees. */
|
|
402
|
+
angleDegrees: number;
|
|
403
|
+
darkReflectance: number;
|
|
404
|
+
lightReflectance: number;
|
|
405
|
+
/** `left`/`right` edges are near-vertical (horizontal MTF), `top`/`bottom` near-horizontal (vertical MTF). */
|
|
406
|
+
edges: {
|
|
407
|
+
side: "left" | "right" | "top" | "bottom";
|
|
408
|
+
midpoint: {
|
|
409
|
+
u: number;
|
|
410
|
+
v: number;
|
|
411
|
+
};
|
|
412
|
+
direction: {
|
|
413
|
+
u: number;
|
|
414
|
+
v: number;
|
|
415
|
+
};
|
|
416
|
+
length: number;
|
|
417
|
+
}[];
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Squares and edges of a `slanted-squares` chart, or of every `slanted-squares` element of a composite, in
|
|
421
|
+
* the chart's frame units (2.3), for slanted-edge regions of interest (Burns, PICS 2000). Directions are unit
|
|
422
|
+
* vectors along each edge (u right, v up).
|
|
423
|
+
*/
|
|
424
|
+
export declare function calculateSlantedSquareEdges(input: {
|
|
425
|
+
scene: ChartScene;
|
|
426
|
+
aspect: number;
|
|
427
|
+
}): ChartSlantedSquare[];
|
|
159
428
|
/**
|
|
160
429
|
* Step reflectances of a step wedge. `equal-density` spaces optical density D = -log10(R) evenly, which
|
|
161
430
|
* gives geometric reflectance steps, as on a photographic step tablet. `linear` spaces reflectance evenly.
|