Skip to content

Commit bfa9af8

Browse files
lpanafCopilot
andauthored
fix the id error in retriangulation (#230)
* fix the id error in retriangulation * f * Update glomap/io/colmap_converter.cc Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ac7df16 commit bfa9af8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

glomap/io/colmap_converter.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ void ConvertDatabaseToGlomap(const colmap::Database& database,
309309
for (const auto& [camera_id, camera] : cameras) {
310310
if (cameras_id_to_rig_id.find(camera_id) == cameras_id_to_rig_id.end()) {
311311
Rig rig;
312-
rig.SetRigId(++max_rig_id);
312+
if (max_rig_id > 0)
313+
rig.SetRigId(++max_rig_id);
314+
else
315+
rig.SetRigId(camera_id);
316+
313317
rig.AddRefSensor(camera.SensorId());
314318
rigs[rig.RigId()] = rig;
315319
cameras_id_to_rig_id[camera_id] = rig.RigId();
@@ -326,7 +330,7 @@ void ConvertDatabaseToGlomap(const colmap::Database& database,
326330
// For images without frames, initialize trivial frames
327331
for (auto& [image_id, image] : images) {
328332
if (image.frame_id == colmap::kInvalidFrameId) {
329-
frame_t frame_id = ++max_frame_id;
333+
frame_t frame_id = (max_frame_id > 0) ? ++max_frame_id : image_id;
330334

331335
CreateFrameForImage(Rigid3d(),
332336
image,

0 commit comments

Comments
 (0)