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

Function main

tests/pycolmap/generate_fixtures.ts:72–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72async function main(): Promise<void> {
73 if (!hasSparseBinaryFixture(BICYCLE_BIN)) {
74 console.error(`[fixtures] bicycle fixture not found at ${BICYCLE_BIN} — skipping`);
75 process.exit(0);
76 }
77 if (!existsSync(WASM_JS) || !existsSync(WASM_BIN)) {
78 console.error('[fixtures] WASM artifacts missing — run `npm run build:wasm` first');
79 process.exit(1);
80 }
81
82 const wasm = await loadWasm();
83 wasm.parseCameras(toAB(resolve(BICYCLE_BIN, 'cameras.bin')));
84 wasm.parseImages(toAB(resolve(BICYCLE_BIN, 'images.bin')));
85 wasm.parsePoints3D(toAB(resolve(BICYCLE_BIN, 'points3D.bin')));
86
87 // Scenario 1: untransformed — writer uses WASM fallback for 2D
88 {
89 const { cameras, images } = buildWasmCameraImageMaps(wasm);
90 const camBuf = writeCamerasBinary(cameras);
91 const imgBuf = writeImagesBinary(images, wasm);
92 const ptBuf = writePoints3DBinary(wasm.buildPoints3DMap());
93 writeScenario('untransformed', camBuf, imgBuf, ptBuf);
94 }
95
96 // Scenario 2: transform baked — simulate applyTransformToData behaviour
97 {
98 const { cameras, images } = buildWasmCameraImageMaps(wasm);
99 const reconstruction: Reconstruction = {
100 cameras,
101 images,
102 imageStats: new Map(),
103 connectedImagesIndex: new Map(),
104 imageToPoint3DIds: new Map(),
105 globalStats: {
106 minError: 0, maxError: 0, avgError: 0,
107 minTrackLength: 0, maxTrackLength: 0, avgTrackLength: 0,
108 totalObservations: 0, totalPoints: 0,
109 },
110 };
111 const eulerParams = {
112 scale: 1.5,
113 rotationX: 0.1,
114 rotationY: 0.7,
115 rotationZ: -0.2,
116 translationX: 0.3,
117 translationY: 0,
118 translationZ: 0.1,
119 };
120 const sim3d = createSim3dFromEuler(eulerParams);
121 // Sidecar: record the applied sim3d so Python can reconstruct the expected
122 // transformation independently.
123 const sidecar = {
124 euler: eulerParams,
125 sim3d: {
126 scale: sim3d.scale,
127 rotation_quat_xyzw: [sim3d.rotation.x, sim3d.rotation.y, sim3d.rotation.z, sim3d.rotation.w],
128 translation: [sim3d.translation.x, sim3d.translation.y, sim3d.translation.z],
129 },

Callers 1

Calls 15

hasSparseBinaryFixtureFunction · 0.90
buildWasmCameraImageMapsFunction · 0.90
createSim3dFromEulerFunction · 0.90
transformReconstructionFunction · 0.90
loadWasmFunction · 0.85
writeCamerasBinaryFunction · 0.85
writeImagesBinaryFunction · 0.85
writePoints3DBinaryFunction · 0.85
writeScenarioFunction · 0.85
buildPoints3DMapMethod · 0.80
getImagePoints2DArrayMethod · 0.80

Tested by

no test coverage detected