board.h
Go to the documentation of this file.
00001 /*****************************
00002 Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without modification, are
00005 permitted provided that the following conditions are met:
00006 
00007    1. Redistributions of source code must retain the above copyright notice, this list of
00008       conditions and the following disclaimer.
00009 
00010    2. Redistributions in binary form must reproduce the above copyright notice, this list
00011       of conditions and the following disclaimer in the documentation and/or other materials
00012       provided with the distribution.
00013 
00014 THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
00015 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
00016 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
00017 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00018 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00019 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00020 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00021 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00022 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00023 
00024 The views and conclusions contained in the software and documentation are those of the
00025 authors and should not be interpreted as representing official policies, either expressed
00026 or implied, of Rafael Muñoz Salinas.
00027 ********************************/
00028 #ifndef _Aruco_board_h
00029 #define _Aruco_board_h
00030 #include <opencv2/core/core.hpp>
00031 #include <string>
00032 #include <vector>
00033 #include "exports.h"
00034 #include "marker.h"
00035 using namespace std;
00036 namespace aruco {
00040 struct ARUCO_EXPORTS MarkerInfo : public vector< cv::Point3f > {
00041     MarkerInfo() {}
00042     MarkerInfo(int _id) { id = _id; }
00043     MarkerInfo(const MarkerInfo &MI) : vector< cv::Point3f >(MI) { id = MI.id; }
00044     MarkerInfo &operator=(const MarkerInfo &MI) {
00045         vector< cv::Point3f >::operator=(MI);
00046         id = MI.id;
00047         return *this;
00048     }
00049     int id; // maker id
00050 };
00051 
00069 class ARUCO_EXPORTS BoardConfiguration : public vector< MarkerInfo > {
00070     friend class Board;
00071 
00072   public:
00073     enum MarkerInfoType {
00074         NONE = -1,
00075         PIX = 0,
00076         METERS = 1
00077     }; // indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
00078     // variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
00079     int mInfoType;
00082     BoardConfiguration();
00086     BoardConfiguration(string filePath) throw(cv::Exception);
00087 
00090     BoardConfiguration(const BoardConfiguration &T);
00091 
00094     BoardConfiguration &operator=(const BoardConfiguration &T);
00097     void saveToFile(string sfile) throw(cv::Exception);
00100     void readFromFile(string sfile) throw(cv::Exception);
00103     bool isExpressedInMeters() const { return mInfoType == METERS; }
00106     bool isExpressedInPixels() const { return mInfoType == PIX; }
00109     int getIndexOfMarkerId(int id) const;
00112     const MarkerInfo &getMarkerInfo(int id) const throw(cv::Exception);
00115     void getIdList(vector< int > &ids, bool append = true) const;
00116 
00117   private:
00120     void saveToFile(cv::FileStorage &fs) throw(cv::Exception);
00123     void readFromFile(cv::FileStorage &fs) throw(cv::Exception);
00124 };
00125 
00128 class ARUCO_EXPORTS Board : public vector< Marker > {
00129 
00130   public:
00131     BoardConfiguration conf;
00132     // matrices of rotation and translation respect to the camera
00133     cv::Mat Rvec, Tvec;
00136     Board() {
00137         Rvec.create(3, 1, CV_32FC1);
00138         Tvec.create(3, 1, CV_32FC1);
00139         for (int i = 0; i < 3; i++)
00140             Tvec.at< float >(i, 0) = Rvec.at< float >(i, 0) = -999999;
00141     }
00142 
00146     void glGetModelViewMatrix(double modelview_matrix[16]) throw(cv::Exception);
00147 
00158     void OgreGetPoseParameters(double position[3], double orientation[4]) throw(cv::Exception);
00159 
00160 
00163     void saveToFile(string filePath) throw(cv::Exception);
00166     void readFromFile(string filePath) throw(cv::Exception);
00167 
00170     void draw(cv::Mat &im, cv::Scalar color, int lineWidth = 1, bool writeId = true);
00171 };
00172 }
00173 
00174 #endif


asr_aruco_marker_recognition
Author(s): Allgeyer Tobias, Meißner Pascal, Qattan Mohamad
autogenerated on Thu Jun 6 2019 21:14:12