pycolmap icon indicating copy to clipboard operation
pycolmap copied to clipboard

Question about pycolmap.incremental_mapping

Open Jemian2023 opened this issue 1 year ago • 3 comments

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.

Jemian2023 avatar Apr 11 '24 03:04 Jemian2023

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)

sarlinpe avatar Apr 11 '24 06:04 sarlinpe

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!

Jemian2023 avatar Apr 11 '24 07:04 Jemian2023

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.

sarlinpe avatar May 27 '24 07:05 sarlinpe