Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@B1ueber2y
Copy link
Contributor

@B1ueber2y B1ueber2y commented Sep 26, 2025

This is a crucial fix. Without this the python side problem construction with pyceres will never work. Broken since the rig abstraction in colmap 3.12.

Equivalent reference in image.cam_from_world from COLMAP 3.11: https://github.com/colmap/colmap/blob/release/3.11/src/pycolmap/scene/image.cc#L81-L87

To reproduce:

import pycolmap

recon = pycolmap.Reconstruction("example/sfm/0")
rig_from_world_1 = recon.frames[1].rig_from_world
rig_from_world_2 = recon.frames[1].rig_from_world
print(id(rig_from_world_1))
print(id(rig_from_world_2))
assert(id(rig_from_world_1) == id(rig_from_world_2))

The assertion fails without this fix.

@B1ueber2y B1ueber2y changed the title frame.rig_from_world in pycolmap should pass by reference rather than copy frame.rig_from_world in pycolmap should return reference rather than copy Sep 26, 2025
@B1ueber2y B1ueber2y changed the title frame.rig_from_world in pycolmap should return reference rather than copy rig_from_world and sensor_from_rig in pycolmap should return reference rather than copy Sep 26, 2025
@B1ueber2y B1ueber2y changed the title rig_from_world and sensor_from_rig in pycolmap should return reference rather than copy rig_from_world and sensor_from_rig in pycolmap should return reference rather than copy. Sep 26, 2025
@B1ueber2y
Copy link
Contributor Author

Same applies to rig.sensor_from_rig(sensor_id).

@B1ueber2y B1ueber2y merged commit 20b2777 into colmap:main Sep 26, 2025
13 checks passed
@B1ueber2y B1ueber2y deleted the fix/pycolmap_rig_from_world branch September 26, 2025 13:26
@robinlindh
Copy link

Ahhhh yes, I've been debugging exactly this for 2 days now after I finally managed to get our custom SfM pipeline upgraded from colmap 3.10 to 3.12.6. Was a pretty big step to get everything running again after all python changes but then I ended up getting just VERY few 3D points after my pipeline ran through.
I am indeed passing in the rig_from_world into a pyceres problem (based loosely off of the custom bundle adjuster python example). The bug you mention here would explain exactly the results I see. I will let you know how it works with the fix. Thank you a lot in advance <3 and fingers crossed!

@robinlindh
Copy link

This fixed my issue indeed. Awesome, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants