[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] tag/tag helpers.h
From: |
Gerhard Reitmayr |
Subject: |
[Toon-members] tag/tag helpers.h |
Date: |
Wed, 22 Apr 2009 23:36:05 +0000 |
CVSROOT: /cvsroot/toon
Module name: tag
Changes by: Gerhard Reitmayr <gerhard> 09/04/22 23:36:05
Modified files:
tag : helpers.h
Log message:
fixes for TooN2
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tag/tag/helpers.h?cvsroot=toon&r1=1.3&r2=1.4
Patches:
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/tag/tag/helpers.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- helpers.h 22 Apr 2009 19:59:37 -0000 1.3
+++ helpers.h 22 Apr 2009 23:36:05 -0000 1.4
@@ -2,6 +2,7 @@
#define TAG_HELPERS_H
#include <TooN/se3.h>
+#include <TooN/wls.h>
namespace tag {
@@ -28,18 +29,17 @@
/// @param[out] H resulting homography
/// @ingroup helpersgroup
-#if 0
template <class It> void getProjectiveHomography(It begin, It end,
TooN::Matrix<3>& H){
assert(std::distance(begin,end) >= 4);
- TooN::WLSCholesky<8> wls;
+ TooN::WLS<8> wls;
for (It it=begin; it!=end; it++) {
const TooN::Vector<2>& a = first_point(*it);
const TooN::Vector<2>& b = second_point(*it);
- const double rows[2][8] = {{a[0], a[1], 1, 0, 0, 0, -b[0]*a[0],
-b[0]*a[1]},
- {0, 0, 0, a[0], a[1], 1, -b[1]*a[0], -b[1]*a[1]}};
- wls.add_df(b[0], TooN::Vector<8>(rows[0]), noise(*it));
- wls.add_df(b[1], TooN::Vector<8>(rows[1]), noise(*it));
+ const TooN::Vector<8> J1 = TooN::makeVector(a[0], a[1], 1, 0, 0, 0,
-b[0]*a[0], -b[0]*a[1]);
+ const TooN::Vector<8> J2 = TooN::makeVector(0, 0, 0, a[0], a[1], 1,
-b[1]*a[0], -b[1]*a[1]);
+ wls.add_mJ(b[0], J1, noise(*it));
+ wls.add_mJ(b[1], J2, noise(*it));
}
wls.compute();
TooN::Vector<8> h = wls.get_mu();
@@ -70,8 +70,6 @@
return H;
}
-#endif
-
/// creates a cross product matrix M from a 3 vector v, such that for all
vectors w, the following holds: v ^ w = M * w
/// @param vec the 3 vector input
/// @param[out] result the 3x3 matrix to set to the cross product matrix
- [Toon-members] tag/tag helpers.h,
Gerhard Reitmayr <=