marker.h
Go to the documentation of this file.
00001 #ifndef _Aruco_Marker_H
00002 #define _Aruco_Marker_H
00003 #include <vector>
00004 #include <iostream>
00005 #include <opencv/cv.h>
00006 #include "cameraparameters.h"
00007 using namespace std;
00008 namespace aruco {
00013 class Marker: public std::vector<cv::Point2f>
00014 {
00015 public:
00016     //id of  the marker
00017     int id;
00018     //size of the markers sides in meters
00019     float ssize;
00020     //matrices of rotation and translation respect to the camera
00021     cv::Mat Rvec,Tvec;
00022 
00025     Marker();
00028     Marker(const Marker &M);
00031     ~Marker() {}
00034     bool isValid()const{return id!=-1 && size()==4;}
00035 
00038     void draw(cv::Mat &in, cv::Scalar color, int lineWidth=1,bool writeId=true);
00039 
00044     void calculateExtrinsics(float markerSize,const CameraParameters &CP)throw(cv::Exception);
00050     void calculateExtrinsics(float markerSize,cv::Mat  CameraMatrix,cv::Mat Distorsion=cv::Mat())throw(cv::Exception);
00051     
00055     void glGetModelViewMatrix(  double modelview_matrix[16])throw(cv::Exception);
00056 
00059     friend bool operator<(const Marker &M1,const Marker&M2)
00060     {
00061         return M1.id<M2.id;
00062     }
00065     friend ostream & operator<<(ostream &str,const Marker &M)
00066     {
00067         str<<M.id<<"=";
00068         for (int i=0;i<4;i++)
00069             str<<"("<<M[i].x<< ","<<M[i].y<<") ";
00070         str<<"Txyz=";
00071         for (int i=0;i<3;i++)
00072             str<<M.Tvec.at<float>(i,0)<<" ";
00073         str<<"Rxyz=";
00074         for (int i=0;i<3;i++)
00075             str<<M.Rvec.at<float>(i,0)<<" ";
00076 
00077         return str;
00078     }
00079     
00099     static cv::Mat createMarkerImage(int id,int size) throw (cv::Exception);
00100     
00101     
00102 private:
00103   void rotateXAxis(cv::Mat &rotation);
00104 
00105 };
00106 
00107 }
00108 #endif


aruco_pose
Author(s): Julian Brunner
autogenerated on Mon Oct 6 2014 08:32:33