colmap / colmap

COLMAP - Structure-from-Motion and Multi-View Stereo
https://colmap.github.io/
Other
7.7k stars 1.52k forks source link

how to run sfm with known camera intrinsics #1526

Open guijuzhejiang opened 2 years ago

guijuzhejiang commented 2 years ago

colmap verison:3.8

colmap feature_extractor --database_path $DATASET_PATH/database.db \ --image_path $DATASET_PATH/images \ --SiftExtraction.max_image_size 3840 \ --ImageReader.single_camera 1 \ --ImageReader.camera_model=PINHOLE \ --ImageReader.camera_params "4479.94,4374.51,2727.48,1811.92"

echo exhaustive_matcher... colmap exhaustive_matcher --database_path $DATASET_PATH/database.db --SiftMatching.guided_matching 0

mkdir -p $DATASET_PATH/sparse/0 colmap mapper \ --database_path $DATASET_PATH/database.db \ --image_path $DATASET_PATH/images \ --output_path $DATASET_PATH/sparse \ --Mapper.ba_refine_principal_point false

i ran cmd above but i got : ERROR: Failed to parse options - unrecognised option '--max_image_size'. stereo_fusion...

StereoFusion::Options

mask_path: max_image_size: -1 min_num_pixels: 5 max_num_pixels: 10000 max_traversal_depth: 100 max_reproj_error: 2 max_depth_error: 0.01 max_normal_error: 10 check_num_images: 50 use_cache: 0 cache_size: 32 bbox_min: -3.40282e+38 -3.40282e+38 -3.40282e+38 bbox_max: 3.40282e+38 3.40282e+38 3.40282e+38

Reading workspace... F0517 20:57:44.282964 8423 misc.cc:310] Check failed: file.is_open() /mnt/hdd/dataset/slam/drone/drone_3/dense/stereo/fusion.cfg Check failure stack trace: @ 0x7fb4ebbbe0cd google::LogMessage::Fail() @ 0x7fb4ebbbff33 google::LogMessage::SendToLog() @ 0x7fb4ebbbdc28 google::LogMessage::Flush() @ 0x7fb4ebbc0999 google::LogMessageFatal::~LogMessageFatal() @ 0x555ec42acf2b (unknown) @ 0x555ec41ac1a4 (unknown) @ 0x555ec42d021c (unknown) @ 0x7fb4c73596df (unknown) @ 0x7fb4c7a386db start_thread @ 0x7fb4c67e761f clone /home/ray/Workspace/project/ORB_SLAM3/src/shell_slam/colmap_pipline.sh: line 56: 8415 Aborted (core dumped) colmap stereo_fusion --workspace_path $DATASET_PATH/dense --workspace_format COLMAP --input_type geometric --output_path $DATASET_PATH/dense/fused.ply

please help

tsattler commented 2 years ago

The error message you show is related to the stereo_fusion approach, which is run after the mapper. You should not see this error message when you run feature extraction, matching, and mapping.

To answer the question on how to run sfm with known intrinsics, you can set the mapper parameters --Mapper.ba_refine_focal_length and --Mapper.ba_refine_extra_params to 0 to avoid that they are refined during the mapping process (see also http://colmap.github.io/faq.html#fix-intrinsics).

kevinchan04 commented 1 year ago

Hi @tsattler , may I aks if I fix camera intrinsic in feature_extraction step at the beginning, does COLMAP return camera poses in real world metrics? If I want to get the camera poses in real world metrics, what should I do? Thank you very much!

tsattler commented 1 year ago

Hi @kevinchan04 , you cannot get camera poses in real world metrics from images alone (independently of whether you know the precise intrinsics or not) as this information is lost when capturing the 3D world in 2D images. You will need to scale the scene based on known distances (e.g., knowing that the distance between a pairs of cameras should be X meters).

hellovuong commented 1 year ago

Hi @tsattler, I am sorry for not opening a new issue; I think it may relate to your reply above. What if I had the RGB-D images, which means that I have depth information of points, where should I change in the code base so that I can use that depth info to obtain the real scale of the sense?

tsattler commented 1 year ago

You can use it to scale the 3D model once it is generated by Colmap.