Skip to content

Fix inconsistent between the actual executed image reader option and the saved project.ini file#1564

Merged
ahojnnes merged 2 commits into
colmap:devfrom
xuchenghust:dev
Aug 18, 2022
Merged

Fix inconsistent between the actual executed image reader option and the saved project.ini file#1564
ahojnnes merged 2 commits into
colmap:devfrom
xuchenghust:dev

Conversation

@xuchenghust

@xuchenghust xuchenghust commented Jul 15, 2022

Copy link
Copy Markdown
Contributor

In current AutomaticReconstructionController implementation, the cli args input are first parsed to construct the member variable options_ of AutomaticReconstructionController class.
Then the options_'s ImageReader part is assigned to ImageReaderOptions reader_options, which is a copy instead of a reference of *option_manager_.image_reader. Which means, user cli args input's ImageReader setting (e.g. single_camera, camera_model) are only passed to options_, and will not be synced to option_manager_.
image

Although the ImageReaderOptions setting reader_options is used to construct the SiftFeatureExtractor, the executed setting is exactly what the user needed. Because the project.ini writing only follows the option_manager_'s values, thus when user modify the default automatic_reconstructor settings (by passing --single_camera=1 or --camera_model="OpenCV"), inconsistency happens between the actual executed image reader option and the saved project.ini file.
image

This bug can be easily fixed by obtaining reader_options by reference instead of a value copy.


- Bug case (using single_camera=1)
Pre Fix:
command:

.\build\src\exe\colmap.exe automatic_reconstructor --workspace_path=data/pre_fix/images --image_path=data/pre_fix/images --single_camera=1

generated project.ini

log_to_stderr=false
random_seed=0
log_level=2
database_path=data/pre_fix/images\database.db
image_path=data/pre_fix/images
[ImageReader]
single_camera=false
single_camera_per_folder=false
single_camera_per_image=false
existing_camera_id=-1
default_focal_length_factor=1.2
mask_path=
camera_model=SIMPLE_RADIAL
camera_params=
camera_mask_path=
[SiftExtraction]
...

After Fix
command:

.\build\src\exe\colmap.exe automatic_reconstructor --workspace_path=data/fix/images --image_path=data/fix/images --single_camera=1
generated project.ini
log_to_stderr=false
random_seed=0
log_level=2
database_path=data/fix/images\database.db
image_path=data/fix/images
[ImageReader]
single_camera=true
single_camera_per_folder=false
single_camera_per_image=false
existing_camera_id=-1
default_focal_length_factor=1.2
mask_path=
camera_model=SIMPLE_RADIAL
camera_params=
camera_mask_path=
[SiftExtraction]
...

- Bug case (using --camera_model="OpenCV")
Pre Fix
command:

.\build\src\exe\colmap.exe automatic_reconstructor --workspace_path=data/pre_fix/images_01 --image_path=data/pre_fix/images_01 --camera_model=OPENCV

generated project.ini

log_to_stderr=false
random_seed=0
log_level=2
database_path=data/pre_fix/images_01\database.db
image_path=data/pre_fix/images_01
[ImageReader]
single_camera=false
single_camera_per_folder=false
single_camera_per_image=false
existing_camera_id=-1
default_focal_length_factor=1.2
mask_path=
camera_model=SIMPLE_RADIAL
camera_params=
camera_mask_path=
[SiftExtraction]
...

After Fix
command:

.\build\src\exe\colmap.exe automatic_reconstructor --workspace_path=data/fix/images_01 --image_path=data/fix/images_01 --camera_model=OPENCV

generated preject.ini

log_to_stderr=false
random_seed=0
log_level=2
database_path=data/fix/images_01\database.db
image_path=data/fix/images_01
[ImageReader]
single_camera=false
single_camera_per_folder=false
single_camera_per_image=false
existing_camera_id=-1
default_focal_length_factor=1.2
mask_path=
camera_model=OPENCV
camera_params=
camera_mask_path=
[SiftExtraction]
...

@ahojnnes ahojnnes enabled auto-merge (squash) July 16, 2022 12:19
@ahojnnes

Copy link
Copy Markdown
Contributor

LGTM, thanks.

@ahojnnes ahojnnes merged commit fd36126 into colmap:dev Aug 18, 2022
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

Successfully merging this pull request may close these issues.

2 participants