sweeneychris / TheiaSfM

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

Failed to convert matches file from VSfM to Theia #259

Closed blacnk-0 closed 3 years ago

blacnk-0 commented 3 years ago

I use code from https://github.com/caomw/VisualSFMToTheiaConverter to convert matches file from VSfM to Theia, but when I run ./build_reconstruction --flagfile=../../build_reconstruction_flags.txt I got the following output:

I0430 19:52:07.141214 21562 track_builder.cc:125] 866892 tracks were created. 20911 features were dropped because they fo$
med inconsistent tracks, and 38466 features were dropped because they did not have enough observations.                   
I0430 19:52:07.760905 21562 reconstruction_builder.cc:358] Attempting to reconstruct 2915 images from 33584 two view matc$
es.                                                                                                                       
I0430 19:52:07.898795 21562 estimate_track.cc:182] 0 tracks were estimated of 10254 possible tracks. 10254 triangulations 
failed due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                     
I0430 19:52:08.029310 21562 estimate_track.cc:182] 0 tracks were estimated of 10323 possible tracks. 10323 triangulations 
failed due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                     
I0430 19:52:08.159782 21562 estimate_track.cc:182] 0 tracks were estimated of 9584 possible tracks. 9584 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:08.290333 21562 estimate_track.cc:182] 0 tracks were estimated of 8837 possible tracks. 8837 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:08.420434 21562 estimate_track.cc:182] 0 tracks were estimated of 8272 possible tracks. 8272 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:08.551335 21562 estimate_track.cc:182] 0 tracks were estimated of 7944 possible tracks. 7944 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:08.683389 21562 estimate_track.cc:182] 0 tracks were estimated of 8041 possible tracks. 8041 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:08.815654 21562 estimate_track.cc:182] 0 tracks were estimated of 7849 possible tracks. 7849 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:08.947597 21562 estimate_track.cc:182] 0 tracks were estimated of 7167 possible tracks. 7167 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:09.080147 21562 estimate_track.cc:182] 0 tracks were estimated of 7514 possible tracks. 7514 triangulations f$
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.                       
I0430 19:52:09.212000 21562 estimate_track.cc:182] 0 tracks were estimated of 7368 possible tracks. 7368 triangulations fa
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.
I0430 19:52:09.343246 21562 estimate_track.cc:182] 1 tracks were estimated of 6672 possible tracks. 6671 triangulations fa
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.
I0430 19:52:09.474742 21562 estimate_track.cc:182] 0 tracks were estimated of 6614 possible tracks. 6614 triangulations fa
iled due to bad triangulation angles and 0 triangulations failed with too high reprojection errors.
I0430 19:52:09.626442 21562 estimate_track.cc:182] 5173 tracks were estimated of 8589 possible tracks. 3412 triangulations
 failed due to bad triangulation angles and 4 triangulations failed with too high reprojection errors.
I0430 19:52:09.694380 21562 incremental_reconstruction_estimator.cc:482] Running full bundle adjustment on the entire reco
nstruction.
I0430 19:52:09.760823 21562 incremental_reconstruction_estimator.cc:510] Selected 5173 tracks to optimize.
I0430 19:52:09.781219 21562 detect_structure.cc:113] Schur complement static structure <2,4,6>.
I0430 19:52:09.784298 21562 callbacks.cc:125] iter      cost      cost_change  |gradient|   |step|    tr_ratio  tr_radius
 ls_iter  iter_time  total_time
   0  1.792536e+05    0.00e+00    3.42e+07   0.00e+00   0.00e+00  1.00e+04        0    3.03e-03    6.84e-03
I0430 19:52:09.784726 21562 detect_structure.cc:113] Schur complement static structure <2,4,6>.
I0430 19:52:09.791873 21562 callbacks.cc:125]    1  5.424730e+02    1.79e+05    1.85e+06   2.82e+00   1.02e+00  3.00e+04
      1    7.46e-03    1.44e-02
I0430 19:52:09.798846 21562 callbacks.cc:125]    2  2.566779e+02    2.86e+02    1.00e+04   1.83e-01   1.00e+00  9.00e+04
      1    6.89e-03    2.14e-02
I0430 19:52:09.805758 21562 callbacks.cc:125]    3  2.557677e+02    9.10e-01    1.75e+04   1.20e-01   1.08e+00  2.70e+05
      1    6.89e-03    2.83e-02
I0430 19:52:09.812690 21562 callbacks.cc:125]    4  2.553189e+02    4.49e-01    6.17e+04   2.08e-01   5.95e-01  2.72e+05
      1    6.91e-03    3.52e-02
I0430 19:52:09.819591 21562 callbacks.cc:125]    5  2.546115e+02    7.07e-01    3.17e+04   1.55e-01   9.35e-01  7.98e+05
      1    6.88e-03    4.21e-02
I0430 19:52:09.826495 21562 callbacks.cc:125]    6  2.544276e+02    1.84e-01    5.82e+04   2.13e-01   3.92e-01  7.90e+05
      1    6.88e-03    4.90e-02
I0430 19:52:09.833400 21562 callbacks.cc:125]    7  2.538990e+02    5.29e-01    1.07e+04   1.04e-01   1.06e+00  2.37e+06
      1    6.89e-03    5.59e-02
I0430 19:52:09.840284 21562 callbacks.cc:125]    8  2.538045e+02    9.45e-02    5.34e+03   7.32e-02   1.24e+00  7.11e+06
      1    6.86e-03    6.28e-02
I0430 19:52:09.847172 21562 callbacks.cc:125]    9  2.537777e+02    2.68e-02    8.76e+02   3.09e-02   1.35e+00  2.13e+07
      1    6.87e-03    6.97e-02
I0430 19:52:09.854069 21562 callbacks.cc:125]   10  2.537722e+02    5.48e-03    2.52e+02   1.66e-02   1.44e+00  6.40e+07
      1    6.88e-03    7.66e-02
I0430 19:52:09.860983 21562 callbacks.cc:125]   11  2.537710e+02    1.23e-03    4.36e+01   6.88e-03   1.46e+00  1.92e+08
      1    6.90e-03    8.35e-02
I0430 19:52:09.867868 21562 callbacks.cc:125]   12  2.537707e+02    2.75e-04    1.09e+01   3.74e-03   1.46e+00  5.76e+08
      1    6.87e-03    9.04e-02
I0430 19:52:09.872161 21562 trust_region_minimizer.cc:707] Terminating: Function tolerance reached. |cost_change|/cost: 2.
430186e-07 <= 1.000000e-06
I0430 19:52:09.873023 21562 bundle_adjuster.cc:206]
Solver Summary (v 1.14.0-eigen-(3.3.90)-lapack-suitesparse-(5.1.2)-cxsparse-(3.1.9)-eigensparse-openmp-no_tbb)

                                     Original                  Reduced
Parameter blocks                         5177                     5175
Parameters                              20718                    20704
Residual blocks                         10346                    10346
Residuals                               20692                    20692

Minimizer                        TRUST_REGION

Dense linear algebra library            EIGEN
Trust region strategy     LEVENBERG_MARQUARDT

                                        Given                     Used
Linear solver                     DENSE_SCHUR              DENSE_SCHUR
Threads                                     8                        8
Linear solver ordering               5173,2,2                   5173,2
Schur structure                         2,4,6                    2,4,6

Cost:
Initial                          1.792536e+05
Final                            2.537707e+02
Change                           1.789998e+05

Minimizer iterations                       13
Successful steps                           13
Unsuccessful steps                          0

Time (in seconds):
Preprocessor                         0.003809

  Residual only evaluation           0.002915 (13)
  Jacobian & residual evaluation     0.028795 (13)
  Linear solver                      0.045974 (13)
Minimizer                            0.091087

Postprocessor                        0.000256
Total                                0.095152

Termination:                      CONVERGENCE (Function tolerance reached. |cost_change|/cost: 2.430186e-07 <= 1.000000e-0
6)
I0430 19:52:09.974849 21562 set_outlier_tracks_to_unestimated.cc:128] 1 points were removed because of bad reprojection er
rors. 76 points were removed because they had insufficient viewing angles and were poorly constrained.
I0430 19:52:09.974869 21562 incremental_reconstruction_estimator.cc:607] 77 outlier points were removed.
F0430 19:52:10.056556 21562 visibility_pyramid.cc:54] Check failed: width_ > 0 (0 vs. 0)
*** Check failure stack trace: ***
    @     0x7fd0245d80cd  google::LogMessage::Fail()
    @     0x7fd0245d9f33  google::LogMessage::SendToLog()
    @     0x7fd0245d7c28  google::LogMessage::Flush()
    @     0x7fd0245da999  google::LogMessageFatal::~LogMessageFatal()
    @     0x562cb533a786  (unknown)
    @     0x562cb5314987  (unknown)
    @     0x562cb531521a  (unknown)
    @     0x562cb52de1fe  (unknown)
    @     0x562cb527d163  (unknown)
    @     0x7fd02121bbf7  __libc_start_main
    @     0x562cb528c9fa  (unknown)
[2]    21562 abort (core dumped)  ./build_reconstruction --flagfile=../../build_reconstruction_flags.txt

It seems that all tracks are filtered due to bad triangulation angles. Is it because i use the wrong version of Theia? My Theia was cloned from github and I get the matches file of VSfM with https://github.com/colmap/colmap/blob/dev/scripts/python/export_to_visualsfm.py. I can use this matches file to run VSfM, but when convert to Theia, I got the above error.

blacnk-0 commented 3 years ago

Set image_width and img_height in CameraIntrinsicsPrior can solve this problem