MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / parseFramesBinary

Function parseFramesBinary

src/parsers/frames.ts:24–71  ·  view source on GitHub ↗
(buffer: ArrayBuffer)

Source from the content-addressed store, hash-verified

22 * - uint64: data_id (image ID for camera sensors)
23 */
24export function parseFramesBinary(buffer: ArrayBuffer): Map<number, Frame> {
25 const reader = new BinaryReader(buffer);
26 const frames = new Map<number, Frame>();
27
28 const numFrames = reader.readUint64AsNumber();
29
30 for (let i = 0; i < numFrames; i++) {
31 const frameId = reader.readUint32();
32 const rigId = reader.readUint32();
33
34 // Read rig_from_world pose: qw, qx, qy, qz, tx, ty, tz
35 const qw = reader.readFloat64();
36 const qx = reader.readFloat64();
37 const qy = reader.readFloat64();
38 const qz = reader.readFloat64();
39 const tx = reader.readFloat64();
40 const ty = reader.readFloat64();
41 const tz = reader.readFloat64();
42
43 const rigFromWorld = {
44 qvec: [qw, qx, qy, qz] as [number, number, number, number],
45 tvec: [tx, ty, tz] as [number, number, number],
46 };
47
48 const numDataIds = reader.readUint32();
49 const dataIds: FrameDataMapping[] = [];
50
51 for (let j = 0; j < numDataIds; j++) {
52 const sensorType = parseSensorType(reader.readInt32(), `binary frame ${frameId} data id ${j}`);
53 const sensorId = reader.readUint32();
54 const dataId = reader.readUint64AsNumber();
55
56 dataIds.push({
57 sensorId: { type: sensorType, id: sensorId },
58 dataId,
59 });
60 }
61
62 frames.set(frameId, {
63 frameId,
64 rigId,
65 rigFromWorld,
66 dataIds,
67 });
68 }
69
70 return frames;
71}
72
73/**
74 * Parse frames.txt text file

Callers 2

frames.test.tsFile · 0.90

Calls 5

readUint64AsNumberMethod · 0.95
readUint32Method · 0.95
readFloat64Method · 0.95
readInt32Method · 0.95
parseSensorTypeFunction · 0.90

Tested by

no test coverage detected