diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-23 15:50:50 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-23 16:12:35 +0300 |
commit | 7d65827980e72750d0c58de9e6865e8d32a7a90c (patch) | |
tree | 309ec681ea3611282f7d3814dfe93a6dabfd2b3d /intern/libmv | |
parent | 361d578f9d928a6f03991d26d6ec9400b200d194 (diff) |
Fix T67089: Solve camera motion generates "Solve error: nan"
The code was missing some checks for whether keyframe selection
went successfully and whether reconstruction has been successfully
initialized.
The interface still gives quite generic message, with the details
printed to the console. This can be addressed separately.
Diffstat (limited to 'intern/libmv')
-rw-r--r-- | intern/libmv/intern/reconstruction.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/intern/libmv/intern/reconstruction.cc b/intern/libmv/intern/reconstruction.cc index e271d663c4a..64f00b19df0 100644 --- a/intern/libmv/intern/reconstruction.cc +++ b/intern/libmv/intern/reconstruction.cc @@ -264,15 +264,15 @@ libmv_Reconstruction *libmv_solveReconstruction( update_callback.invoke(0, "Selecting keyframes"); - selectTwoKeyframesBasedOnGRICAndVariance(tracks, + if (selectTwoKeyframesBasedOnGRICAndVariance(tracks, normalized_tracks, *camera_intrinsics, keyframe1, - keyframe2); - - /* so keyframes in the interface would be updated */ - libmv_reconstruction_options->keyframe1 = keyframe1; - libmv_reconstruction_options->keyframe2 = keyframe2; + keyframe2)) { + /* so keyframes in the interface would be updated */ + libmv_reconstruction_options->keyframe1 = keyframe1; + libmv_reconstruction_options->keyframe2 = keyframe2; + } } /* Actual reconstruction. */ @@ -283,7 +283,7 @@ libmv_Reconstruction *libmv_solveReconstruction( LG << "number of markers for init: " << keyframe_markers.size(); - if (keyframe_markers.size() < 8) { + if (keyframe_markers.size() < 16) { LG << "No enough markers to initialize from"; libmv_reconstruction->is_valid = false; return libmv_reconstruction; @@ -291,13 +291,18 @@ libmv_Reconstruction *libmv_solveReconstruction( update_callback.invoke(0, "Initial reconstruction"); - EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction); + if (!EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction)) { + LG << "Failed to initialize reconstruction"; + libmv_reconstruction->is_valid = false; + return libmv_reconstruction; + } + EuclideanBundle(normalized_tracks, &reconstruction); EuclideanCompleteReconstruction(normalized_tracks, &reconstruction, &update_callback); - /* Refinement/ */ + /* Refinement. */ if (libmv_reconstruction_options->refine_intrinsics) { libmv_solveRefineIntrinsics( tracks, |