Hierarchical-Localization icon indicating copy to clipboard operation
Hierarchical-Localization copied to clipboard

Localizing Query and saving its output in bin files

Open thealchemist-x opened this issue 2 years ago • 1 comments

Hi,

Thanks for the support this community has provided. I would like to ask, when I use localize_sfm.main() to find my query within a mapping dataset, how can I save the outputs in a format that can be accessed by colmap-gui? I would like this so that I can visualize the matching results and their correspondences between the query and mapping images.

I would like to generate the files (points3D.bin, images.bin, cameras.bin, database.db) with localize_sfm.main() in the same way as triangulation.main() and reconstruction.main() does for us.

Thanks for your guidance!~

thealchemist-x avatar Aug 30 '22 19:08 thealchemist-x

You can read the output text file and create a COLMAP model from scratch using pycolmap:

rec = pycolmap.Reconstruction()
camera_id = 1
cam1 = pycolmap.Camera(model_name, w, h, params, camera_id)
rec.add_camera(cam1)
im1 = pycolmap.Image(image_name, [], tvec, qvec, camera_id, id=1)
rec.add_image(im1)
rec.write("path/")

This could be a useful feature - feel free to open a PR for it.

sarlinpe avatar Sep 13 '22 06:09 sarlinpe