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

Hardcoded camera in preprocess/prepare_chunk.py causes error #90

Open
stas-polukeev opened this issue Nov 13, 2024 · 5 comments
Open

Hardcoded camera in preprocess/prepare_chunk.py causes error #90

stas-polukeev opened this issue Nov 13, 2024 · 5 comments

Comments

@stas-polukeev
Copy link

Hey, thanks for the great work!
I have a reconstruction, which fails during chunking stage. to be exact it fails at this code (prepare_chunk.py, line 75)
print("extracting features...") colmap_feature_extractor_args = [ colmap_exe, "feature_extractor", "--database_path", f"{bundle_adj_chunk}/database.db", "--image_path", f"{bundle_adj_chunk}/images", "--ImageReader.existing_camera_id", "1", ]

I was using 6 cameras, but inspecting the undistorted images showed, that the colmap managed to reconstruct only cam3.
Colmap throws error ExistsCamera, which seems logical, as there is only camera 3, but there is hardcoded --ImageReader.existing_camera_id 1
Am I understanding this correctly, and if so:

  1. Why is 1 hardcoded?
  2. Is there any way to adapt it for more flexible Id selection or importing multiple cameras?
  3. Where else can i look?
    Thanks in advance
@ameuleman
Copy link
Collaborator

Hi,
--ImageReader.existing_camera_id 1 tells COLMAP to use the ids already in the database ("1" is "true", not an id).
What error message do you get exactly?

@stas-polukeev
Copy link
Author

Thanks for your response!
As of now I don't have access to the logs, however I remember them having problems exactly at this line of colmap code:
https://github.com/colmap/colmap/blob/8d4d504e731460213339ffb4d61d979e6624e1e8/src/colmap/controllers/image_reader.cc#L73C3-L75C70

It throws the ExistCamera() error and does that for every raw chunk (they are created, so the make_chunk.py script works fine)
so the prepare_chunks.py (exactly here https://github.com/graphdeco-inria/hierarchical-3d-gaussians/blob/main/preprocess/prepare_chunk.py#L74C1-L80C10) fails due to this error and does not create chunks folder with BA, which in turn ruins the whole pipeline.

It fails consistently every time the camera with id 1 is not detected during colmap, so it is not shown in rectified folder and in the database too.

I have actually modified fill_database.py to print the camera id that it finds in the database and used it in prepare_chunk.py, which solved the problem.

As for the existing_camera_id being bool, I may be wrong, but in the same lines of colmap code I referenced the existing_camera_id parameter is casted to camera_t which is uint32_t and not boolean (https://github.com/colmap/colmap/blob/main/src/colmap/util/types.h#L80)

Please, correct me if I'm mistaken

@ameuleman
Copy link
Collaborator

You are right, the parameter description I found was misleading. Thank you for pointing this out. This means that our preprocessing pipeline needs some fixing. In the meantime, the initial feature extraction parameter should be --ImageReader.single_camera instead of --ImageReader.single_camera_per_folder.

@stas-polukeev
Copy link
Author

I can commit my workaround solution consisting of a few lines of extra code that jsut grabs first camera that the database has, so its guaranteed to work as long as you have any cameras
about the single_camera parameter, in which script do you suggest changing it? initial generate_colmap.py? does this imply, that all cameras should share the same intrinsics? does this assumption hold even for gopros you used in the paper?

@ameuleman
Copy link
Collaborator

I already updated generate_colmap.py. Yes, all cameras should share intrinsic and our gopros are very similar.

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