Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small question about camera model (multi focal length) #53

Open
oUp2Uo opened this issue Mar 21, 2024 · 4 comments
Open

Small question about camera model (multi focal length) #53

oUp2Uo opened this issue Mar 21, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@oUp2Uo
Copy link

oUp2Uo commented Mar 21, 2024

Hi, thanks for the great support for multi focal length, it works fine.
And I have some small questions about camera model part.

  1. Why does model simple-radial set default value K1=0.1?
    Meanwhile, model opencv sets default value K1=K2=0.
    https://github.com/3DOM-FBK/deep-image-matching/blob/master/src/deep_image_matching/io/h5_to_db.py#L159

  2. Manually editing cameras.yaml makes users can set everything, but it is not a easy usage when calculating large image set (>hundreds).
    Now I have written a small program to scan the file names in a folder.
    So my actually process is: 1. Put different focal length images in seperated sub-folders. 2. Run the scan program to get the file names in every sub-folders. 3. Move all the images in sub-folders to the images folder. 4. Edit cameras.yaml to fill in the file names.
    If ImageMatching class could scan sub-folders, it will be no need to do these steps. This makes all the images use a same camera model, which is not so flexible, but we can change it using COLMAP UI later.
    Of course, this is not a functional question, just for easy using for large data set.

Thank you.

@lcmrl
Copy link
Collaborator

lcmrl commented Mar 21, 2024

Hi, good to know that works fine!

  1. If you let pycolmap to refine distortion params, K1 is just an initial guess. No problem in keeping K1=0.1. In any case K1=0.0 is an usual choice, I will change it, thanks!
    In main.py you can choose to refine or not extra params which are distortion params
    if use_pycolmap:
        # import reconstruction module
        reconstruction = import_module("deep_image_matching.reconstruction")

        # Optional - You can specify some reconstruction configuration
        # reconst_opts = (
        #     {
        #         "ba_refine_focal_length": True,
        #         "ba_refine_principal_point": False,
        #         "ba_refine_extra_params": False,
        #     },
        # )
        reconst_opts = {}
  1. Yes using subfolders is for sure the best option. It needs a bit more work respect what we just did, we have to check no conflicts in the image paths, we planned to switch to this for the next release. So, for now yes, you have a bit more 'manual' work, let you know when it will available in dev. If you have time, feel free to make the needed changes and push them in dev

Thanks for the feedback!

@oUp2Uo
Copy link
Author

oUp2Uo commented Mar 21, 2024

  1. If you let pycolmap to refine distortion params, K1 is just an initial guess. No problem in keeping K1=0.1. In any case K1=0.0 is an usual choice, I will change it, thanks!

I know it is an initial value, but sometimes large distortion initial value may cause fail to calculate camera position (especially when focal length is large).
And actually, I do not know how to give a 'good initial value'.
So when the calculation result is wrong, usually I would try to calibrate the camera using chessboard, and then using the calibration result as the initial value. Or just try and try.
I wonder whether is there a better way to get a initial value.
(Of course, maybe this is not this project's work, should be COLMAP or OpenMVG's.)

  1. Yes using subfolders is for sure the best option. It needs a bit more work respect what we just did, we have to check no conflicts in the image paths, we planned to switch to this for the next release. So, for now yes, you have a bit more 'manual' work, let you know when it will available in dev. If you have time, feel free to make the needed changes and push them in dev

Thanks for hearing your plan.
I could write C/C++ fast, but sadly I am not good at Python, even feel difficult to understand the code.
Please just take your time to add subfolders, it is not much important. The multi focal length function is working well now. And subfolders is the icing on the cake. : )

@lcmrl
Copy link
Collaborator

lcmrl commented Mar 22, 2024

Are you working on photogrammetric applications or SLAM sequences? If the camera network is good enough you should not have problems with self-calibration. In any case you can always acquire a specific image sequence for the calibration and eventually keeping fix the internal parameters later. Maybe are you using a fisheye?

Ok I will put label enhancement for this issue

@lcmrl lcmrl added the enhancement New feature or request label Mar 22, 2024
@oUp2Uo
Copy link
Author

oUp2Uo commented Mar 25, 2024

Are you working on photogrammetric applications or SLAM sequences? If the camera network is good enough you should not have problems with self-calibration. In any case you can always acquire a specific image sequence for the calibration and eventually keeping fix the internal parameters later. Maybe are you using a fisheye?

Ok I will put label enhancement for this issue

Photogrammetric applications.
When images overlap is not enough, it is difficult to calculation the position.
So sometimes I just take some wide-angle images to help the location. And usually wide-angle images (~ or > 100 degree, OpenCV fisheye model usually has a better result than pinhole) have a larger distortion than normal using images. And they are more sensitive when using COLMAP to optimize the intrinsics. If distortion initial value is not near the true value, position calculation usually fail or has few images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants