[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] tag/tag ransac_estimators.h
From: |
Gerhard Reitmayr |
Subject: |
[Toon-members] tag/tag ransac_estimators.h |
Date: |
Tue, 09 Dec 2008 20:37:57 +0000 |
CVSROOT: /cvsroot/toon
Module name: tag
Changes by: Gerhard Reitmayr <gerhard> 08/12/09 20:37:57
Modified files:
tag : ransac_estimators.h
Log message:
missing ransac estimator for camera rotation
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tag/tag/ransac_estimators.h?cvsroot=toon&r1=1.7&r2=1.8
Patches:
Index: ransac_estimators.h
===================================================================
RCS file: /cvsroot/toon/tag/tag/ransac_estimators.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- ransac_estimators.h 31 Oct 2007 10:26:22 -0000 1.7
+++ ransac_estimators.h 9 Dec 2008 20:37:57 -0000 1.8
@@ -16,6 +16,7 @@
#include <TooN/wls_cholesky.h>
#include <tag/helpers.h>
+#include <tag/absorient.h>
namespace tag {
@@ -260,6 +261,42 @@
}
};
+/// RANSAC estimator to compute a camera rotation between two sets of rays:
+/// The rays are specified as 2D vectors on the camera plane. The minimal
+/// set are two corresponding pairs of rays.
+/// @code
+/// TooN::Vector<2> a = first_point(*it); // default value is "(*it).first"
+/// TooN::Vector<2> b = second_point(*it); // default value is "(*it).second"
+/// double R = noise(*it); // default value is "1.0"
+/// @endcode
+/// The resulting transformation will map from a -> b.
+/// @ingroup ransac
+struct CameraRotation {
+ /// homography
+ TooN::SO3 rotation;
+ /// minimal number of correspondences
+ static const int hypothesis_size = 2;
+
+ template <class It> void estimate(It begin, It end) {
+ assert(std::distance(begin, end) == hypothesis_size);
+ if(TooN::norm_sq(first_point(begin[0])) == first_point(begin[0]) *
first_point(begin[1]) ||
+ TooN::norm_sq(second_point(begin[0])) == second_point(begin[0]) *
second_point(begin[1]))
+ return;
+ rotation =
tag::computeOrientation(TooN::unproject(first_point(begin[0])),
+ TooN::unproject(second_point(begin[0])),
+ TooN::unproject(first_point(begin[1])),
+ TooN::unproject(second_point(begin[1])));
+ }
+
+ template <class M> inline double score(const M& m) const {
+ const TooN::Vector<2> disp = TooN::project(rotation *
TooN::unproject(first_point(m))) - second_point(m);
+ return (disp*disp);
+ }
+
+ template <class M> inline bool isInlier(const M& m, double r) const {
+ return this->score(m) <= r*r * noise(m);
+ }
+};
struct PlaneFromPoints {
/// the plane equation coefficients as homogeneous vector with unit
normal, or (0,0,0,1)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] tag/tag ransac_estimators.h,
Gerhard Reitmayr <=