ModelObject3D.hh
Go to the documentation of this file.
00001 
00006 #ifndef P_COMPUTE_OBJECT_MODEL_3D_HH
00007 #define P_COMPUTE_OBJECT_MODEL_3D_HH
00008 
00009 #include <blort/Recognizer3D/PNamespace.hh>
00010 #include <blort/Recognizer3D/Object3D.hh>
00011 #include <blort/Recognizer3D/Array.hh>
00012 #include <blort/Recognizer3D/Definitions.hh>
00013 #include <blort/Recognizer3D/CodebookEntry.hh>
00014 #include <blort/Recognizer3D/Geometry.hh>
00015 #include <string>
00016 
00017 namespace P
00018 {
00019 
00024 class ModelObject3D
00025 {
00026 private:
00027   void ComputeNewHnorm(P::Array<KeypointDescriptor*> &keys, double Hnorm[9]);
00028   void InsertMeanShift(Array<KeypointDescriptor* > &keys, P::Array<CodebookEntry*> &codebook, double H[9]);
00029 
00030 
00031 public:
00032   ModelObject3D();
00033   ~ModelObject3D();
00034 
00035   void AddToModel(Array<KeypointDescriptor *> &keys, Object3D &obj);
00036   void SaveModel(const char *filename, Object3D &obj);
00037   bool LoadModel(const std::string filename, Object3D &obj);
00038 
00039   inline void MapPoint(double xin, double yin, double H[9], double &xout, double &yout);
00040   inline void MapPoint(double in[2], double H[9], double out[2]);
00041   inline void GetPosScaleAngle( double x, double y, double H[9], double &xr, double &yr, double &scale, double &angle);
00042 
00043 };
00044 
00045 
00046 /*********************** INLINE METHODES **************************/
00047 
00052 inline void ModelObject3D::MapPoint(double xin, double yin, double H[9], double &xout, double &yout)
00053 {
00054   xout = H[0]*xin + H[1]*yin + H[2];
00055   yout = H[3]*xin + H[4]*yin + H[5];
00056   double t = H[6]*xin + H[7]*yin + H[8];
00057   xout /= t;
00058   yout /= t;
00059 }
00060 
00065 inline void ModelObject3D::MapPoint(double in[2], double H[9], double out[2])
00066 {
00067   out[0] = H[0]*in[0] + H[1]*in[1] + H[2];
00068   out[1] = H[3]*in[0] + H[4]*in[1] + H[5];
00069   double t = H[6]*in[0] + H[7]*in[1] + H[8];
00070   out[0] /= t;
00071   out[1] /= t;
00072 }
00073 
00077 inline void ModelObject3D::GetPosScaleAngle( double x, double y, double H[9], double &xr, double &yr, double &scale, double &angle)
00078 {
00079   double x2=x+10.;
00080   double y2=y;
00081   double x2H,y2H;
00082   MapPoint(x,y,H,xr,yr);
00083   MapPoint(x2,y2,H,x2H,y2H);
00084 
00085   double dxH=x2H-xr;
00086   double dyH=y2H-yr;
00087   scale=((sqrt(dxH*dxH+dyH*dyH))/10.);
00088   angle=atan2(dyH,dxH);
00089 }
00090 
00091 
00092 }
00093 
00094 #endif
00095 


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12