00001
00002
00003 #ifndef LOCALIZER_TSAI_HPP
00004 #define LOCALIZER_TSAI_HPP
00005
00006 #include "kernel/jafarException.hpp"
00007 #include "localizer/point2d3d.hpp"
00008 #include "jmath/jblas.hpp"
00009 #include "jmath/linearLeastSquares.hpp"
00010
00011 #include "geom/Declarations.hpp"
00012
00013 namespace jafar {
00014
00015 namespace localizer {
00016
00028 class TsaiLocalizer {
00029
00033 protected:
00034
00036 static const double epsylon;
00038 double alphaU;
00040 double alphaV;
00042 double u0;
00044 double v0;
00046 Points2d3d pointsVector;
00048 jblas::mat a;
00050 jblas::vec b;
00052 jblas::vec x;
00054 jmath::LinearLeastSquares lls;
00056 jblas::mat44 M;
00058 void initSystem(const int& _cols = 1,
00059 const int& _rows = 1);
00061 double sign(const double& d);
00062
00066 public:
00067
00068 enum ReferenceType {
00069 JAFAR,
00070 CALIFE
00071 };
00072
00081 TsaiLocalizer(const double& _alphaU,
00082 const double& _alphaV,
00083 const double& _u0,
00084 const double& _v0,
00085 const ReferenceType& type=TsaiLocalizer::JAFAR);
00086
00087 virtual ~TsaiLocalizer();
00089 void setPointsVector(const Points2d3d& _pointsVector);
00090 void addPoint2d3d(const Point2d3d& p2d3d)
00091 {
00092 pointsVector.push_back(p2d3d);
00093 }
00094 void addPoint2d3d(const jblas::vec2& p2d, const jblas::vec3& p3d)
00095 {
00096 pointsVector.push_back(localizer::Point2d3d(p2d, p3d));
00097 }
00098 void addPoint2d3d(const double &u, const double &v,
00099 const double &x, const double &y, const double &z)
00100 {
00101 pointsVector.push_back(localizer::Point2d3d(u,v,x,y,z));
00102 }
00104
00105
00107 void setPointsVector(const std::vector<jblas::vec2>& _2DPointsVector,
00108 const std::vector<jblas::vec3>& _3DPointsVector);
00110 virtual void localize() = 0;
00111
00113 double computeError(const jblas::vec& a,
00114 const double& tz,
00115 const jblas::vec& b,
00116 const int& nb);
00117
00119 jblas::mat44 transitionMatrix();
00121 size_t size()
00122 {
00123 return pointsVector.size();
00124 }
00125 };
00126
00127 }
00128
00129 }
00130 #endif