Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Question about pycolmap.incremental_mapping #272

Open
Jemian2023 opened this issue Apr 11, 2024 · 3 comments
Open

Question about pycolmap.incremental_mapping #272

Jemian2023 opened this issue Apr 11, 2024 · 3 comments

Comments

@Jemian2023
Copy link

Hello, I would like to ask a question about pycolmap.incremental_mapping. Can I fix the known image pose for colmap 3D reconstruction in pycolmap.incremental_mapping. In the process, the map points are just triangulated and optimized, at the meantime the pose of query images and fixed.

@sarlinpe
Copy link
Member

sarlinpe commented Apr 11, 2024

To optimize only existing 3D points, you can use pycolmap.bundle_adjustment as

opts = {'refine_extrinsics': False, 'refine_focal_length': False, 'refine_extra_params': False}
pycolmap.bundle_adjustment(reconstruction, opts)

If you want to also refine a subset of poses, this is currently only possible by building your own BA problem with pyceres (example here) but we will soon have a much simpler way of doing so by binding the BundleAdjuster (cc @B1ueber2y)

@Jemian2023
Copy link
Author

Sorry, maybe I misspoke what I mean. What I want to express is that I have a bunch of images and their internal parameters and their accurate poses. I want to use the Hloc pipeline, such as the pipeline of "disk+lightglue+netvlad". and then I use Pycolmap to perform 3D reconstruction to generate sparse 3D models. The coordinate system of the image and map points in the model must be consistent with the original image coordinate system. How can I do this? Thank you.

I guess if I can perform as:

options = {"num_threads": min(multiprocessing.cpu_count(), 16),  "fix_existing_images": true, **options}
pycolmap.incremental_mapping(database_path, image_dir, models_path, options=options)

Is this plan feasible? Looking forward to your reply!

@sarlinpe
Copy link
Member

If you want to retain the camera poses and intrinsic parameters and simply need a sparse 3D model, you can perform triangulation:

pycolmap.triangulate_points(reconstruction, database_path, image_path, output_path, ...)

You can optionally later refine the parameters with pycolmap.bundle_adjustment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants