MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / parseCamerasBinary

Function parseCamerasBinary

src/parsers/cameras.ts:23–52  ·  view source on GitHub ↗
(buffer: ArrayBuffer)

Source from the content-addressed store, hash-verified

21 * - double[]: params (variable count based on model)
22 */
23export function parseCamerasBinary(buffer: ArrayBuffer): Map<number, Camera> {
24 const reader = new BinaryReader(buffer);
25 const cameras = new Map<number, Camera>();
26
27 const numCameras = reader.readUint64AsNumber();
28
29 for (let i = 0; i < numCameras; i++) {
30 const cameraId = reader.readUint32();
31 const modelId = parseCameraModelId(reader.readInt32(), `binary camera ${cameraId}`);
32 const width = reader.readUint64AsNumber();
33 const height = reader.readUint64AsNumber();
34
35 // Get number of parameters for this camera model
36 const numParams = getCameraModelNumParams(modelId);
37 const params: number[] = [];
38 for (let j = 0; j < numParams; j++) {
39 params.push(reader.readFloat64());
40 }
41
42 cameras.set(cameraId, {
43 cameraId,
44 modelId,
45 width,
46 height,
47 params,
48 });
49 }
50
51 return cameras;
52}
53
54/** A camera record skipped by {@link parseCamerasText} because its model is unknown. */
55export interface SkippedCameraRecord {

Callers 4

cameras.test.tsFile · 0.90
integrity.test.tsFile · 0.90

Calls 6

readUint64AsNumberMethod · 0.95
readUint32Method · 0.95
readInt32Method · 0.95
readFloat64Method · 0.95
parseCameraModelIdFunction · 0.90
getCameraModelNumParamsFunction · 0.90

Tested by

no test coverage detected