Image Component Library (ICL)
PoseEstimator.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLGeom/src/ICLGeom/PoseEstimator.h **
10 ** Module : ICLGeom **
11 ** Authors: Christof Elbrechter, Robert Haschke **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLGeom/GeomDefs.h>
35 
36 namespace icl{
37  namespace geom{
38 
39 
41 
56 
59 
60  public:
62  enum MapMode {
67  };
68 
70 
75  template<class T> ICLGeom_API
77  ;
78 
80 
81  template<class T, unsigned int NUM_POINTS>
84  {
85  return map(Xs.dyn(),Ys.dyn(), mode);
86  }
87 
89 
90  template<class T, unsigned int NUM_POINTS>
93  {
94  return map(Xs.dyn(),Ys.dyn(), mode);
95  }
96 
98  static Mat map(const std::vector<Vec> &Xs, const std::vector<Vec> &Ys, MapMode mode=RigidBody)
99  {
100  ICLASSERT_THROW(Xs.size() == Ys.size(), utils::ICLException("PoseEstimator::map: need same number of input- and output-points"));
101  math::DynMatrix<double> XsD(Xs.size(),3),YsD(Ys.size(),3);
102  for(unsigned int i=0;i<Xs.size();++i){
103  std::copy(Xs[i].begin(),Xs[i].begin()+3, XsD.col_begin(i));
104  std::copy(Ys[i].begin(),Ys[i].begin()+3, YsD.col_begin(i));
105  }
106  return map(XsD,YsD,mode);
107  }
108 
110  template<class T> ICLGeom_API
111  static math::FixedMatrix<T,3,3> quaternion_to_rotation_matrix(T w, T x, T y, T z);
112  };
113 
114  } // namespace geom
115 }
returns a transformation for the mean translation between the point-sets
Definition: PoseEstimator.h:63
Powerful and highly flexible matrix class implementation.
Definition: FixedMatrix.h:172
undocument this line if you encounter any issues!
Definition: Any.h:37
#define ICLGeom_API
Definition: CompatMacros.h:179
Highly flexible and optimized matrix class implementation.
Definition: DynMatrix.h:81
PoseEstimator()
Private constructor -> no instances of PoseEstimator possible.
Definition: PoseEstimator.h:58
MapMode
The MapMode determines, how the point-to-point transformation is computed.
Definition: PoseEstimator.h:62
static ICLGeom_API math::FixedMatrix< T, 4, 4 > map(const math::DynMatrix< T > &Xs, const math::DynMatrix< T > &Ys, MapMode mode=RigidBody)
main mapping function, that is called by all other convenience wrappers (instantiated for T=icl32f an...
most common RigidBody mapping (using eigenvector analysis and quaternion representation)
Definition: PoseEstimator.h:64
static ICLGeom_API math::FixedMatrix< T, 3, 3 > quaternion_to_rotation_matrix(T w, T x, T y, T z)
utility function (instantiated for depth32f and depth64f)
static math::FixedMatrix< T, 4, 4 > map(const math::FixedMatrix< T, NUM_POINTS, 4 > &Xs, const math::FixedMatrix< T, NUM_POINTS, 4 > &Ys, MapMode mode=RigidBody)
Convenienc template that uses FixedMatrix inputs (available for T=icl32f and T=icl64f)
Definition: PoseEstimator.h:91
Base class for Exception handling in the ICL.
Definition: Exception.h:42
static Mat map(const std::vector< Vec > &Xs, const std::vector< Vec > &Ys, MapMode mode=RigidBody)
Convenience function that passes std::vector<Vec> data as DynMatrix<T> to other map function.
Definition: PoseEstimator.h:98
affine mapping: (XX^-1 * XY)^T (here, at least 4 points are needed)
Definition: PoseEstimator.h:66
void copy(const T *src, const T *srcEnd, T *dst)
moves data from source to destination array (no casting possible)
Definition: CoreFunctions.h:216
DynMatrix< T > dyn()
creates a shallow copied DynMatrix instance wrapping this' data
Definition: FixedMatrix.h:177
#define ICLASSERT_THROW(X, OBJ)
Definition: Macros.h:155
Utility class for 6D PoseEstimation.
Definition: PoseEstimator.h:55
as RigidBody, but with additional scaling
Definition: PoseEstimator.h:65
static math::FixedMatrix< T, 4, 4 > map(const math::FixedMatrix< T, NUM_POINTS, 3 > &Xs, const math::FixedMatrix< T, NUM_POINTS, 3 > &Ys, MapMode mode=RigidBody)
Convenienc template that uses FixedMatrix inputs (available for T=icl32f and T=icl64f)
Definition: PoseEstimator.h:82