sweeneychris / TheiaSfM

An open source library for multiview geometry and structure from motion
Other
904 stars 281 forks source link

how to use application: calibrate_camera_intrinsics #260

Closed lookou closed 3 years ago

lookou commented 3 years ago

I use the files https://drive.google.com/file/d/1UIOIUb1UegYypb_roJPgDIuWruOsj4Jc/view?usp=sharing Note:

jpg files: with exif info 
png files: without exif info 

and I use the command:

./bin/calibrate_camera_intrinsics  --matching_working_directory=/tmp/ --images=/tmp/heif/*.jpg -alsologtostderr

how could i get the correct intrinsics? now it directly shows the *1.2 max( image.width, image.height)** initial value. but not run the optimazied part.

Log like this:

Image was resize to 450X600

I20210506 18:19:45.269865  6846 calibrate_camera_intrinsics.cc:261] This calibration technique simply runs incremental SfM several times while refining the intrinsic parameters. After each iteration, the intrinsic parameters output are then used as the initialization point for the next round of SfM. Each iteration recomputes matching and the reconstruction from scratch to obtain the best possible results. It is recommended to use at least 5 images and up to 100 images with a wide range of motion for calibration.
didn't know how to process Exif:SubjectArea, type 3 x 4
/home/xiaoxin/codes/C/camera_guess/thirdparty/TheiaSfM/src/theia/sfm/feature_extractor_and_matcher.cc:246  focal lenth: 720.000000
I20210506 18:19:45.277366  6848 feature_extractor_and_matcher.cc:261] Image /tmp/heif/IMG_7296.jpg is initialized with the focal length: 720
didn't know how to process Exif:SubjectArea, type 3 x 4
/home/xiaoxin/codes/C/camera_guess/thirdparty/TheiaSfM/src/theia/sfm/feature_extractor_and_matcher.cc:246  focal lenth: 720.000000
I20210506 18:19:45.306449  6848 feature_extractor_and_matcher.cc:261] Image /tmp/heif/IMG_3998.jpg is initialized with the focal length: 720
didn't know how to process Exif:SubjectArea, type 3 x 4
/home/xiaoxin/codes/C/camera_guess/thirdparty/TheiaSfM/src/theia/sfm/feature_extractor_and_matcher.cc:246  focal lenth: 720.000000
I20210506 18:19:45.332226  6848 feature_extractor_and_matcher.cc:261] Image /tmp/heif/IMG_1183.jpg is initialized with the focal length: 720
didn't know how to process Exif:SubjectArea, type 3 x 4
/home/xiaoxin/codes/C/camera_guess/thirdparty/TheiaSfM/src/theia/sfm/feature_extractor_and_matcher.cc:246  focal lenth: 720.000000
I20210506 18:19:45.341409  6848 feature_extractor_and_matcher.cc:261] Image /tmp/heif/IMG_9185.jpg is initialized with the focal length: 720
didn't know how to process Exif:SubjectArea, type 3 x 4
/home/xiaoxin/codes/C/camera_guess/thirdparty/TheiaSfM/src/theia/sfm/feature_extractor_and_matcher.cc:246  focal lenth: 720.000000
I20210506 18:19:45.366746  6848 feature_extractor_and_matcher.cc:261] Image /tmp/heif/IMG_5465.jpg is initialized with the focal length: 720
I20210506 18:19:45.390707  6846 feature_extractor_and_matcher.cc:213] Matching images...
I20210506 18:19:45.880623  6846 reconstruction_builder.cc:267] 10 of 10 view pairs were matched and geometrically verified.
I20210506 18:19:45.883013  6846 track_builder.cc:125] 540 tracks were created. 5 features were dropped because they formed inconsistent tracks, and 0 features were dropped because they did not have enough observations.
I20210506 18:19:45.883152  6846 reconstruction_builder.cc:357] Attempting to reconstruct 5 images from 10 two view matches.
I20210506 18:19:45.893350  6846 estimate_track.cc:182] 176 tracks were estimated of 226 possible tracks. 47 triangulations failed due to bad triangulation angles and 3 triangulations failed with too high reprojection errors.
I20210506 18:19:45.893472  6846 incremental_reconstruction_estimator.cc:482] Running full bundle adjustment on the entire reconstruction.
I20210506 18:19:45.893512  6846 incremental_reconstruction_estimator.cc:510] Selected 176 tracks to optimize.
I20210506 18:19:45.914881  6846 set_outlier_tracks_to_unestimated.cc:128] 2 points were removed because of bad reprojection errors. 0 points were removed because they had insufficient viewing angles and were poorly constrained.
I20210506 18:19:45.914923  6846 incremental_reconstruction_estimator.cc:607] 2 outlier points were removed.
I20210506 18:19:45.919271  6846 set_outlier_tracks_to_unestimated.cc:128] 2 points were removed because of bad reprojection errors. 0 points were removed because they had insufficient viewing angles and were poorly constrained.
I20210506 18:19:45.919299  6846 incremental_reconstruction_estimator.cc:607] 2 outlier points were removed.
I20210506 18:19:45.932716  6846 estimate_track.cc:182] 195 tracks were estimated of 363 possible tracks. 159 triangulations failed due to bad triangulation angles and 9 triangulations failed with too high reprojection errors.
I20210506 18:19:45.932796  6846 incremental_reconstruction_estimator.cc:482] Running full bundle adjustment on the entire reconstruction.
I20210506 18:19:45.932905  6846 incremental_reconstruction_estimator.cc:510] Selected 367 tracks to optimize.
I20210506 18:19:46.194273  6846 set_outlier_tracks_to_unestimated.cc:128] 6 points were removed because of bad reprojection errors. 0 points were removed because they had insufficient viewing angles and were poorly constrained.
I20210506 18:19:46.194327  6846 incremental_reconstruction_estimator.cc:607] 6 outlier points were removed.
I20210506 18:19:46.201018  6846 incremental_reconstruction_estimator.cc:607] 0 outlier points were removed.
I20210506 18:19:46.213892  6846 estimate_track.cc:182] 137 tracks were estimated of 179 possible tracks. 33 triangulations failed due to bad triangulation angles and 9 triangulations failed with too high reprojection errors.
I20210506 18:19:46.213956  6846 incremental_reconstruction_estimator.cc:482] Running full bundle adjustment on the entire reconstruction.
I20210506 18:19:46.214056  6846 incremental_reconstruction_estimator.cc:510] Selected 498 tracks to optimize.
W20210506 18:19:46.323441  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.324738  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.330687  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.336621  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.342569  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.343842  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.356710  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.362684  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.368723  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.369994  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.376029  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.382061  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.388126  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.394116  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.395403  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.401362  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.407354  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.408649  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.419399  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.420660  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.431324  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.432598  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.438632  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.444586  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.450503  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.451799  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.457728  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.463738  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
I20210506 18:19:46.466660  6846 set_outlier_tracks_to_unestimated.cc:128] 16 points were removed because of bad reprojection errors. 0 points were removed because they had insufficient viewing angles and were poorly constrained.
I20210506 18:19:46.466683  6846 incremental_reconstruction_estimator.cc:607] 16 outlier points were removed.
I20210506 18:19:46.467916  6846 set_outlier_tracks_to_unestimated.cc:128] 1 points were removed because of bad reprojection errors. 0 points were removed because they had insufficient viewing angles and were poorly constrained.
I20210506 18:19:46.467937  6846 incremental_reconstruction_estimator.cc:607] 1 outlier points were removed.
I20210506 18:19:46.476104  6846 estimate_track.cc:182] 34 tracks were estimated of 59 possible tracks. 0 triangulations failed due to bad triangulation angles and 25 triangulations failed with too high reprojection errors.
I20210506 18:19:46.476192  6846 incremental_reconstruction_estimator.cc:482] Running full bundle adjustment on the entire reconstruction.
I20210506 18:19:46.476294  6846 incremental_reconstruction_estimator.cc:510] Selected 515 tracks to optimize.
W20210506 18:19:46.538733  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.540104  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.546473  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
W20210506 18:19:46.552861  6846 levenberg_marquardt_strategy.cc:114] Linear solver failure. Failed to compute a step: Eigen failure. Unable to perform dense Cholesky factorization.
I20210506 18:19:46.555977  6846 set_outlier_tracks_to_unestimated.cc:128] 17 points were removed because of bad reprojection errors. 0 points were removed because they had insufficient viewing angles and were poorly constrained.
I20210506 18:19:46.556005  6846 incremental_reconstruction_estimator.cc:607] 17 outlier points were removed.
I20210506 18:19:46.556262  6846 reconstruction_builder.cc:373] 
Reconstruction estimation statistics: 
        Num estimated views = 5
        Num input views = 5
        Num estimated tracks = 498
        Num input tracks = 540
        Pose estimation time = 0.010667
        Triangulation time = 0.034623
        Bundle Adjustment time = 0.594232
        Total time = 0.672988

Incremental Reconstruction Estimator timings:
        Time to find an initial seed for the reconstruction: 0.031759
I20210506 18:19:46.557101  6846 print_reconstruction_statistics.h:83] 
Num observations: 1475
Num reprojections behind camera: 0
Mean reprojection error = 0.703101
Median reprojection_error = 0.481482
I20210506 18:19:46.557148  6846 print_reconstruction_statistics.h:112] Mean track length: 2.96185
I20210506 18:19:46.557171  6846 print_reconstruction_statistics.h:119] Median track length: 3
I20210506 18:19:46.557185  6846 print_reconstruction_statistics.h:123] Track length histogram = 
[2 - 3) = 191 
[3 - 4) = 164 
[4 - 5) = 114 
[5 - 6) = 29 
[6 - 7) = 0 
[7 - 8) = 0 
[8 - 9) = 0 
[9 - 10) = 0 
[10 - 15) = 0 
[15 - 20) = 0 
[20 - 25) = 0 
[25 - 50) = 0 
I20210506 18:19:46.557201  6846 pinhole_camera_model.cc:174] Camera model type: PINHOLE
Focal length (pixels): 720
Principal Point (px, py) = (225, 300)
Skew: 0
Aspect Ratio: 1
RadialDistortion: 0, 0
focal length:720.000000
aspect_ratio:1.000000
sweeneychris commented 3 years ago

I would highly recommend using hte default "flags" file for this binary. It contains a good set of default parameters to use for the calibration method, including the part where BA is set to optimize intrinsics: https://github.com/sweeneychris/TheiaSfM/blob/master/applications/calibrate_camera_intrinsics_flags.txt#L74