-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Pose Prior based Incremental Mapper #2660
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
Conversation
…p and solve BundleAdjustment problems with a position prior for some images.
…the use_robust_loss_on_prior_position parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this contribution and sorry that it took me so long to look at it. This is very exciting! Did you test this on real data and could you share a sample of such data?
@sarlinpe thanks for your reply! I have a sample dataset of real data here acquired with a UAV with photos having GPS in the EXIF metadata here: https://filesender.renater.fr/?s=download&token=0418e1d0-ed8d-4bd4-89ec-e9f0b7772fe7. |
src/colmap/scene/database_cache.cc
Outdated
Timer timer; | ||
timer.Start(); | ||
|
||
if (NumPosePriors() < 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is only valid for when only having position based priors.
Conceptually, it feels like the database cache should at most warn but not produce an error in this case. I would have expected the incremental mapper to error out in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are completely right. I have modified it so that it only returns false if there is no prior in the database.
src/colmap/exe/sfm.cc
Outdated
|
||
options.mapper->use_prior_position = true; | ||
|
||
options.AddDefaultOption("set_database_priors_covariance", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the following maybe a more intuitive option name? If I understand correctly, if this is 67F4 false, then the covariance is read from the database?
options.AddDefaultOption("set_database_priors_covariance", | |
options.AddDefaultOption("overwrite_priors_covariance", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me 👍
Yes for now, the covariance is always read from the database but enabling the option overwrites the current state of the priors covariance.
I am planning to later add more ways for setting up the priors covariance (python / c++ scripts to set it from a file and maybe also a button in the database_widget).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great effort. I left another round of mostly "nit" comments. After this, the PR looks good to me and we can merge from my perspective. Thank you very much!
…riors with the synthetic_dataset.
…s long as there is at least one.
No tests were added for |
@B1ueber2y I wanted to do it and then forgot... I have just made a PR with test for PositionPriorErrorCostFunctor! |
@ferreram Thank you! |
Is there a pycolmap interface for the pose_prior_mapper functionality? |
Yes colmap/src/pycolmap/estimators/bundle_adjustment.cc Lines 195 to 201 in 1a497f0
|
May I ask for example on how to use this interface? Until recently my flow looked like this:
A) With the pycolmap.create_pose_prior_bundle_adjuster how would the above flow change?
C) Would the pose_prior_bundle_adjuster be executed by calling "solve" and where would results be stored?
|
A) You would like perform a pose prior based bundle adjustment after your call to triangulation. You may want to alternative a few rounds of (re-)triangulation and bundle adjustment until convergence. |
@ferreram I performed the following processes:
Error Encountered:
If you have any solutions., please let me know! |
To my knowledge, you have to insert the pose prior to the database, ie. the database.db. Colmap itself can only read and convert that info from exif info of the images. Please check if your images have corresponding information. Otherwise you have to insert manually.
I think there is a py interface named writeposeprior, please checkout on the pycolmap directory.
Liu Zhen
…________________________________
From: Shuta Ochiai ***@***.***>
Sent: Monday, December 2, 2024 10:38:55 AM
To: colmap/colmap ***@***.***>
Cc: Liu Zhen ***@***.***>; Mention ***@***.***>
Subject: Re: [colmap/colmap] Pose Prior based Incremental Mapper (PR #2660)
@ferreram<https://github.com/ferreram>
Thanks for your great code!
I tried the pose_prior_mapper cmd, but I got an error saying No pose priors in database...
I performed the following processes:
1. get images and poses from ARKit app (without points clouds)
2. convert ARKit fmt to colmap fmt (images.bin/txt, cameras.bin/txt, points3D.bin/txt(empty), database.db)
directory configuration:
arkit_data_path/
|--- input/
|--- frame_00001.jpg
|--- frame_....jpg
|--- sparse/
|--- 0/
|--- images.bin/txt
|--- cameras.bin/txt
|--- points3D.bin/txt
|--- database.db
1. extract feature
colmap feature_extractor
--database_path arkit_data_path/sparse/0/database.db
--image_path arkit_data_path/input
--SiftExtraction.use_gpu 1
--ImageReader.single_camera 1
1. feature matching
colmap sequential_mathcer
--database_path arkit_data_path/sparse/0/databse.db
--SiftExtraction.use_gpu 1
1. pose prior mapper
colmap pose_prior_mapper
--image_path arkit_data_path/input
--database_path arkit_data_path/sparse/0/database.db
--output_path sfm_processed_data_path
--Mapper.multiple_models 0
--Mapper.ba_refine_focal_length 0
--Mapper.ba_refine_extra_params 0
--overwrite_priors_covariance 1
--prior_position_std_x 0.05
--prior_position_std_y 0.05
--prior_position_std_z 0.01
1. bundle adjuster
colmap bundle_adjuster
--input_path sfm_processed_data_path
--output_path sfm_processed_data_path
--BundleAdjustment.refine_focal_length 0
--BundleAdjustment.refine_principal_point 0
--BundleAdjustment.refine_extra_params 0
Error Encountered:
I1202 01:23:10.560431 948 sfm.cc:54] Setting up database pose priors with the same covariance matrix:
0.0025 0 0
0 0.0025 0
0 0 0.0001
I1202 01:23:10.574162 948 incremental_pipeline.cc:237] Loading database
I1202 01:23:10.624039 948 database_cache.cc:66] Loading cameras...
I1202 01:23:10.628621 948 database_cache.cc:76] 1 in 0.005s
I1202 01:23:10.628628 948 database_cache.cc:84] Loading matches...
I1202 01:23:11.159878 948 database_cache.cc:89] 1082 in 0.531s
I1202 01:23:11.159904 948 database_cache.cc:105] Loading images...
I1202 01:23:16.291671 948 database_cache.cc:153] 200 in 5.132s (connected 200)
I1202 01:23:16.291709 948 database_cache.cc:164] Loading pose priors...
I1202 01:23:16.612479 948 database_cache.cc:175] 0 in 0.321s
I1202 01:23:16.612496 948 database_cache.cc:184] Building correspondence graph...
I1202 01:23:16.776397 948 database_cache.cc:210] in 0.164s (ignored 0)
I1202 01:23:16.776595 948 timer.cc:91] Elapsed time: 0.103
I1202 01:23:16.776602 948 database_cache.cc:228] Setting up prior positions...
E1202 01:23:16.776602 948 database_cache.cc:234] No pose priors in database...
E1202 01:23:16.950085 948 sfm.cc:465] failed to create sparse model
If you have any solutions., please let me know!
—
Reply to this email directly, view it on GitHub<#2660 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AK4XSWCYXGHHHCF6BROZINT2DPB37AVCNFSM6AAAAABLA434QSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJQGQ2DGOBTGY>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@ahojnnes I tried a basic call to create_pose_prior_bundle_adjuster, but get an exception:
Could you share a mini example that could serve me and the community as a guide? Version details:
|
Is there an official instruction or example to use the GPS prior? That will be very useful for the community. |
This PR adds the possibility to apply the Incremental Mapper pipeline while using position priors taken from the database. The prior position can be either in geographic coordinates or in cartesian coordinates. The position priors are used during the global BA only. For now, this prior based pipeline is only accessible through command line. A unit test has been added.
More is to come (add python bindings, prior based BA controller, possibility to setup priors from a file instead of through the database, python scripts to populate the database with priors, etc...) but I'd like to ensure that you are already okay with the current state of this PR before diving further.