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

Function writeCamerasText

src/parsers/colmapTextWriters.ts:16–31  ·  view source on GitHub ↗
(cameras: Map<CameraId, Camera>)

Source from the content-addressed store, hash-verified

14import { formatDouble, sortedKeys, toTextPoint3DId } from './colmapWriterUtils';
15
16export function writeCamerasText(cameras: Map<CameraId, Camera>): string {
17 const lines: string[] = [];
18
19 lines.push('# Camera list with one line of data per camera:');
20 lines.push('# CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]');
21 lines.push(`# Number of cameras: ${cameras.size}`);
22
23 for (const cameraId of sortedKeys(cameras)) {
24 const cam = cameras.get(cameraId)!;
25 const modelName = CAMERA_MODEL_NAMES[cam.modelId] ?? 'UNKNOWN';
26 const params = cam.params.map(formatDouble).join(' ');
27 lines.push(`${cameraId} ${modelName} ${cam.width} ${cam.height} ${params}`);
28 }
29
30 return lines.join('\n') + '\n';
31}
32
33export function writeImagesText(
34 images: Map<ImageId, Image>,

Calls 2

sortedKeysFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected