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

Multiple cameras instead of single one #219

Closed
alex-klimov opened this issue Aug 17, 2022 · 3 comments
Closed

Multiple cameras instead of single one #219

alex-klimov opened this issue Aug 17, 2022 · 3 comments

Comments

@alex-klimov
Copy link

Brilliant library! Thank you for creating it.

I have an issue in following setup. I have multiple videos captured with single iPhone. Videos are converted to images with ffmpeg tool. All images are getting localized in 3D reconstruction and the position seems to be correct. However, in output colmap model I see mutiple cameras created with different intrinsic parameters.

I tried to specify mode with Single camera, but that didn't change anything:

model = reconstruction.main(sfm_dir, images, sfm_pairs, feature_path, match_path, camera_mode=pycolmap.CameraMode.SINGLE, verbose=True)

How should I specify that I have single camera only? If I know intrinsic parameters, can I pass them over?

@sarlinpe
Copy link
Member

  1. Multiple cameras: does it create a different camera per video or per image? do the resulting cameras differ in terms of image width, height, or other parameters? The default mode, auto, should already assign a single camera to multiple images if they share the same width, height, and EXIF (see here).

  2. Providing intrinsic parameters: check out PR Control over COLMAP import and reconstruction options #210, in which image_options accepts:

  • camera_model: name of the camera model, defined here
  • camera_params: comma-separated list of parameters

Example:

opts = dict(camera_model='SIMPLE_RADIAL', camera_params=','.join(map(str, (f, cx, cy, k))))
model = reconstruction.main(..., image_options=opts)

You can decide to not refine them by adding

reconstruction.main(..., mapper_options=dict(ba_refine_focal_length=False, ba_refine_extra_params=False))

@alex-klimov
Copy link
Author

  1. Multiple cameras: does it create a different camera per video or per image? do the resulting cameras differ in terms of image width, height, or other parameters?

For 222 images I get 222 cameras in colmap model. They all have the same type, resolution, but other parameters are different. A few lines from exported cameras.txt are below. The same result was with AUTO mode.

222 SIMPLE_RADIAL 1920 1080 1817.3906929107477 960 540 0.019831876407632894
221 SIMPLE_RADIAL 1920 1080 1821.8578476946591 960 540 0.016013266424875335
220 SIMPLE_RADIAL 1920 1080 1811.8596737213134 960 540 0.02046293865115948
219 SIMPLE_RADIAL 1920 1080 1790.8546264657789 960 540 0.049830436594508185

Please note, that all these images come from the same iPhone camera. There is an extra step of filming the video first and then using ffmpeg to screenshot frames.

Is this result expected?

  1. Providing intrinsic parameters: check out PR

Thank you! Looking...

@alex-klimov
Copy link
Author

It works, I needed to grab the latest version and recompile pycolmap.

This code:

opts = dict(camera_model='OPENCV')
model = reconstruction.main(sfm_dir, images, sfm_pairs, feature_path, 
                            match_path, camera_mode=pycolmap.CameraMode.SINGLE,
                            image_options=opts,
                            verbose=True)

now returns this, which is exactly what I need. Thank you!

# Camera list with one line of data per camera:
#   CAMERA_ID, MODEL, WIDTH, HEIGHT, PARAMS[]
# Number of cameras: 1
1 OPENCV 1920 1080 1811.1298157393007 1810.6222237771328 960 540 0.11586891523566556 -0.2866863386323682 0.0007904899863632694 -0.00084223979478173624

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

No branches or pull requests

2 participants