diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-26 19:43:20 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-26 19:43:20 +0400 |
commit | 126ca24dbf85d6c3385b5c9c1c22773fece00bb7 (patch) | |
tree | d5e287af42cebc3e92ef1ad24e841b3c66bef3e4 /extern | |
parent | dfc406fc2c5b4e547330c5383cf6c555e5866511 (diff) |
Fix for BA possible move bundles behind the camera
In some cases (was noticed on not good enough keyframe
pair) bundle adjuster could have moved bundles behind
the camera.
This could indeed lead to lower rewprojection error but
this is just pointless thing to do.
Now added check to residuals functor which will return
false to Ceres in cases point moved behind the camera
to prevent such issues.
Diffstat (limited to 'extern')
-rw-r--r-- | extern/libmv/libmv/simple_pipeline/bundle.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/extern/libmv/libmv/simple_pipeline/bundle.cc b/extern/libmv/libmv/simple_pipeline/bundle.cc index f068e050b48..0aca8790587 100644 --- a/extern/libmv/libmv/simple_pipeline/bundle.cc +++ b/extern/libmv/libmv/simple_pipeline/bundle.cc @@ -83,6 +83,10 @@ struct OpenCVReprojectionError { x[1] += R_t[4]; x[2] += R_t[5]; + // Prevent bundles from being moved behind the camera. + if (x[2] < T(0)) + return false; + // Compute normalized coordinates: x /= x[2]. T xn = x[0] / x[2]; T yn = x[1] / x[2]; |