board.h
Go to the documentation of this file.
1 /*****************************
2 Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
3 
4 Redistribution and use in source and binary forms, with or without modification, are
5 permitted provided that the following conditions are met:
6 
7  1. Redistributions of source code must retain the above copyright notice, this list of
8  conditions and the following disclaimer.
9 
10  2. Redistributions in binary form must reproduce the above copyright notice, this list
11  of conditions and the following disclaimer in the documentation and/or other materials
12  provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
15 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
17 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 
24 The views and conclusions contained in the software and documentation are those of the
25 authors and should not be interpreted as representing official policies, either expressed
26 or implied, of Rafael Muñoz Salinas.
27 ********************************/
28 #ifndef _Aruco_board_h
29 #define _Aruco_board_h
30 #include <opencv2/opencv.hpp>
31 #include <string>
32 #include <vector>
33 #include <aruco/exports.h>
34 #include <aruco/marker.h>
35 using namespace std;
36 namespace aruco {
40 struct ARUCO_EXPORTS MarkerInfo:public vector<cv::Point3f> {
41  MarkerInfo() : id(-1) {}
42  MarkerInfo(int _id) : id(_id) {}
43  MarkerInfo(const MarkerInfo&MI): vector<cv::Point3f>(MI){id=MI.id; }
45  vector<cv::Point3f> ::operator=(MI);
46  id=MI.id;
47  return *this;
48  }
49  int id;//maker id
50 };
51 
69 class ARUCO_EXPORTS BoardConfiguration: public vector<MarkerInfo>
70 {
71  friend class Board;
72 public:
73  enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
74  //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
75  int mInfoType;
79 
83 
86  BoardConfiguration & operator=(const BoardConfiguration &T);
89  void saveToFile(string sfile)throw (cv::Exception);
92  void readFromFile(string sfile)throw (cv::Exception);
95  bool isExpressedInMeters()const {
96  return mInfoType==METERS;
97  }
100  bool isExpressedInPixels()const {
101  return mInfoType==PIX;
102  }
105  int getIndexOfMarkerId(int id)const;
108  const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception);
111  void getIdList(vector<int> &ids,bool append=true)const;
112 private:
115  void saveToFile(cv::FileStorage &fs)throw (cv::Exception);
118  void readFromFile(cv::FileStorage &fs)throw (cv::Exception);
119 };
120 
123 class ARUCO_EXPORTS Board:public vector<Marker>
124 {
125 
126 public:
128  //matrices of rotation and translation respect to the camera
129  cv::Mat Rvec,Tvec;
133  {
134  Rvec.create(3,1,CV_32FC1);
135  Tvec.create(3,1,CV_32FC1);
136  for (int i=0;i<3;i++)
137  Tvec.at<float>(i,0)=Rvec.at<float>(i,0)=NAN;
138  }
139 
143  void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception);
144 
155  void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception);
156 
157 
160  void saveToFile(string filePath)throw(cv::Exception);
163  void readFromFile(string filePath)throw(cv::Exception);
164 
165 };
166 }
167 
168 #endif
#define ARUCO_EXPORTS
Definition: exports.h:42
cv::Mat Tvec
Definition: board.h:129
MarkerInfo & operator=(const MarkerInfo &MI)
Definition: board.h:44
MarkerInfo(int _id)
Definition: board.h:42
BoardConfiguration conf
Definition: board.h:127
This class defines a board with several markers. A Board contains several markers so that they are mo...
Definition: board.h:69
bool isExpressedInPixels() const
Definition: board.h:100
bool isExpressedInMeters() const
Definition: board.h:95
MarkerInfo(const MarkerInfo &MI)
Definition: board.h:43


aruco
Author(s): Rafael Muñoz Salinas , Bence Magyar
autogenerated on Wed Sep 2 2020 04:02:09