diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-25 13:27:57 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-25 13:27:57 +0400 |
commit | a0d646d1869162806a2d7050d748669978dd94db (patch) | |
tree | 2c409325b291244ac75f07523179f3c7b801003e /extern/libmv/libmv/multiview/homography.cc | |
parent | 12baa00b6a9aef7622f46b572bef0be9af4d647d (diff) |
Synchronize libmv with own branch
Should be no functional changes, just would help a lot
checking on which stuff was/shall be merged from tomato
and which is not.
Diffstat (limited to 'extern/libmv/libmv/multiview/homography.cc')
-rw-r--r-- | extern/libmv/libmv/multiview/homography.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/extern/libmv/libmv/multiview/homography.cc b/extern/libmv/libmv/multiview/homography.cc index b5c483998d8..538c62598c0 100644 --- a/extern/libmv/libmv/multiview/homography.cc +++ b/extern/libmv/libmv/multiview/homography.cc @@ -264,4 +264,19 @@ bool Homography3DFromCorrespondencesLinear(const Mat &x1, return false; } } + +double SymmetricGeometricDistance(Mat3 &H, Vec2 &x1, Vec2 &x2) { + Vec3 x(x1(0), x1(1), 1.0); + Vec3 y(x2(0), x2(1), 1.0); + + Vec3 H_x = H * x; + Vec3 Hinv_y = H.inverse() * y; + + H_x /= H_x(2); + Hinv_y /= Hinv_y(2); + + return (H_x.head<2>() - y.head<2>()).squaredNorm() + + (Hinv_y.head<2>() - x.head<2>()).squaredNorm(); +} + } // namespace libmv |