3DOM-FBK / deep-image-matching

Multiview matching with deep-learning and hand-crafted local features for COLMAP and other SfM software. Supports high-resolution formats and images with rotations. Both CLI and GUI are supported.
https://3dom-fbk.github.io/deep-image-matching/
BSD 3-Clause "New" or "Revised" License
332 stars 37 forks source link

About multi focal length #45

Closed oUp2Uo closed 6 months ago

oUp2Uo commented 7 months ago

Hi, it seems that only support single camera now. (export_to_colmap in main.py just pass single_camera=True) https://github.com/3DOM-FBK/deep-image-matching/blob/master/main.py#L63

Is it possible to have more than one camera? For example, put images in different sub-folders, and then auto generate camera ID for each sub-folder.

Thanks.

franioli commented 7 months ago

Hey, yes, the function for exporting the matches to a COLMAP database so far supports only the option to use a separate camera for each image or a single camera for all the images (as you can see from the main.py). However, if you go a bit further in the main script, you can see that you can also use pycolmap to build the COLMAP database and also run a first reconstruction. Pycolmap is able to infer the camera parameters from the exif of each image and therefore it can discriminate images taken from two different cameras. Also, you can overwrite the camera parameters estimated by pycolmap from exif with your own (see the example in the main and pay attention to give the cameras in the same order that is detected by pycolmap).

Nevertheless, your suggestion of dividing the images in subfolder and assigning a different camera for each is for sure interesting and we may add it to the to-do list (even though probably it won't be a top priority).

Let us know

oUp2Uo commented 7 months ago

Thanks for the reply. As I said in the last issue, I am using windows and now has bug with pycolmap. T_T Could not use it.

I think images taken with different focal length may lead to a better reconstruction result, since the zoom images provide the details.

Hope you could have time to deal with this. :)

davyzhao1983 commented 6 months ago

hey, I'm also looking forward to the multi-camera function supporting……

lcmrl commented 6 months ago

For now you can simply change single_camera=True to single_camera=False in main.py:

# Export in colmap format
database_path = output_dir / "database.db"
export_to_colmap(
    img_dir=imgs_dir,
    feature_path=feature_path,
    match_path=match_path,
    database_path=database_path,
    camera_model="simple-radial",
    single_camera=False,
)

then you can import the database in COLMAP GUI and manually change the cameras as you prefer. You can also write a script to reassign the cameras in the COLMAP database (see example here how to work with COLMAP databases in python https://github.com/colmap/colmap/blob/main/scripts/python/database.py). Thanks to both for the feedbacks, for sure working by directories to assign different cameras will be done, hope to have time next week, not sure

lcmrl commented 6 months ago

Hi, we had time to add multicamera options in master branch and in the new release. Please, see https://3dom-fbk.github.io/deep-image-matching/camera_models/ for documentation. Let us know if you find any problem, feel free to open a new issue

oUp2Uo commented 6 months ago

Hi, thanks for the message! I will have a try quickly.