diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-04 18:02:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-04 18:02:05 +0300 |
commit | 8600dc6365a544fdee2ec2d00b5b7b980f61613e (patch) | |
tree | 5104566d0ea4e1c854e58db933006f7bb77e80c0 /extern | |
parent | 2f637004d57b4220e483dc60f72edc86b88d3102 (diff) |
Fix T42800: Blender suddenly closes after pressing solve camera motion
Couple of issues:
- Fist/last frame calculation was wrong
- Keyframe selection might silently fail leading to unpredictable math
errors all over the place. Now if keyframe selection fails solver wouldn't
run.
Diffstat (limited to 'extern')
-rw-r--r-- | extern/libmv/intern/reconstruction.cc | 13 | ||||
-rw-r--r-- | extern/libmv/intern/reconstruction.h | 2 | ||||
-rw-r--r-- | extern/libmv/intern/stub.cc | 4 |
3 files changed, 19 insertions, 0 deletions
diff --git a/extern/libmv/intern/reconstruction.cc b/extern/libmv/intern/reconstruction.cc index f89efd8e8ca..046671e467f 100644 --- a/extern/libmv/intern/reconstruction.cc +++ b/extern/libmv/intern/reconstruction.cc @@ -61,6 +61,7 @@ struct libmv_Reconstruction { CameraIntrinsics *intrinsics; double error; + bool is_valid; }; namespace { @@ -289,6 +290,12 @@ libmv_Reconstruction *libmv_solveReconstruction( LG << "number of markers for init: " << keyframe_markers.size(); + if (keyframe_markers.size() < 8) { + LG << "No enough markers to initialize from"; + libmv_reconstruction->is_valid = false; + return libmv_reconstruction; + } + update_callback.invoke(0, "Initial reconstruction"); EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction); @@ -319,6 +326,7 @@ libmv_Reconstruction *libmv_solveReconstruction( progress_update_callback, callback_customdata); + libmv_reconstruction->is_valid = true; return (libmv_Reconstruction *) libmv_reconstruction; } @@ -377,9 +385,14 @@ libmv_Reconstruction *libmv_solveModal( progress_update_callback, callback_customdata); + libmv_reconstruction->is_valid = true; return (libmv_Reconstruction *) libmv_reconstruction; } +int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction) { + return libmv_reconstruction->is_valid; +} + void libmv_reconstructionDestroy(libmv_Reconstruction *libmv_reconstruction) { LIBMV_OBJECT_DELETE(libmv_reconstruction->intrinsics, CameraIntrinsics); LIBMV_OBJECT_DELETE(libmv_reconstruction, libmv_Reconstruction); diff --git a/extern/libmv/intern/reconstruction.h b/extern/libmv/intern/reconstruction.h index 88e810b54aa..8b6b34a6142 100644 --- a/extern/libmv/intern/reconstruction.h +++ b/extern/libmv/intern/reconstruction.h @@ -68,6 +68,8 @@ libmv_Reconstruction* libmv_solveModal( reconstruct_progress_update_cb progress_update_callback, void* callback_customdata); +int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction); + void libmv_reconstructionDestroy(libmv_Reconstruction* libmv_reconstruction); int libmv_reprojectionPointForTrack( diff --git a/extern/libmv/intern/stub.cc b/extern/libmv/intern/stub.cc index f307d831475..f02509de90a 100644 --- a/extern/libmv/intern/stub.cc +++ b/extern/libmv/intern/stub.cc @@ -138,6 +138,10 @@ libmv_Reconstruction *libmv_solveModal( return NULL; } +int libmv_reconstructionIsValid(libmv_Reconstruction * /*libmv_reconstruction*/) { + return 0; +} + int libmv_reprojectionPointForTrack( const libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/, |