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

Function writeRigsText

src/parsers/colmapTextWriters.ts:125–157  ·  view source on GitHub ↗
(rigs: Map<RigId, Rig>)

Source from the content-addressed store, hash-verified

123}
124
125export function writeRigsText(rigs: Map<RigId, Rig>): string {
126 const lines: string[] = [];
127
128 lines.push('# Rig list with one line per sensor');
129 lines.push('# RIG_ID, NUM_SENSORS, REF_SENSOR_TYPE, REF_SENSOR_ID');
130 lines.push('# SENSOR_TYPE, SENSOR_ID, HAS_POSE[, QW, QX, QY, QZ, TX, TY, TZ]');
131 lines.push(`# Number of rigs: ${rigs.size}`);
132
133 for (const rigId of sortedKeys(rigs)) {
134 const rig = rigs.get(rigId)!;
135 const refSensorType = rig.refSensorId?.type ?? 0;
136 const refSensorId = rig.refSensorId?.id ?? 0;
137
138 lines.push(`${rigId} ${rig.sensors.length} ${refSensorType} ${refSensorId}`);
139
140 for (let i = 1; i < rig.sensors.length; i++) {
141 const sensor = rig.sensors[i];
142 const hasPose = sensor.hasPose ? 1 : 0;
143
144 if (sensor.hasPose && sensor.pose) {
145 const [qw, qx, qy, qz] = sensor.pose.qvec;
146 const [tx, ty, tz] = sensor.pose.tvec;
147 lines.push(
148 `${sensor.sensorId.type} ${sensor.sensorId.id} ${hasPose} ${formatDouble(qw)} ${formatDouble(qx)} ${formatDouble(qy)} ${formatDouble(qz)} ${formatDouble(tx)} ${formatDouble(ty)} ${formatDouble(tz)}`
149 );
150 } else {
151 lines.push(`${sensor.sensorId.type} ${sensor.sensorId.id} ${hasPose}`);
152 }
153 }
154 }
155
156 return lines.join('\n') + '\n';
157}
158
159export function writeFramesText(frames: Map<FrameId, Frame>): string {
160 const lines: string[] = [];

Calls 3

sortedKeysFunction · 0.90
formatDoubleFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected