Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Fiducial.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLMarkers/src/ICLMarkers/Fiducial.h                   **
00010 ** Module : ICLMarkers                                             **
00011 ** Authors: Christof Elbrechter                                    **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.GPL  **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #include <bitset>
00034 
00035 #include <ICLUtils/Point32f.h>
00036 #include <ICLGeom/GeomDefs.h>
00037 #include <ICLCV/ImageRegion.h>
00038 
00039 namespace icl{
00040   namespace markers{
00041     
00043     struct FiducialImpl;
00044     struct FiducialDetectorPlugin;
00048 
00049 
00055     class Fiducial{
00057       FiducialImpl *impl;
00058       
00059       public:
00060       
00061       
00063 
00064       enum Feature{
00065         Center2D,     
00066         Rotation2D,   
00067         Corners2D,    
00068         KeyPoints2D,  
00069         ImageRegion,  
00070         Center3D,     
00071         Rotation3D,   
00072         Pose3D,       
00073         FeatureCount  
00074       };
00075       
00077 
00079       typedef std::bitset<(int)FeatureCount> FeatureSet;
00080   
00082       static const FeatureSet AllFeatures;
00083       
00085 
00091       struct KeyPoint{
00093         inline KeyPoint(){}
00094         
00096         inline KeyPoint(const utils::Point32f &imagePos, const utils::Point32f &markerPos, int ID):
00097         imagePos(imagePos),markerPos(markerPos),ID(ID){}
00098   
00099         utils::Point32f imagePos;  
00100         utils::Point32f markerPos; 
00101         int ID;             
00102       };
00103       
00105       inline Fiducial(FiducialImpl *impl=0):impl(impl){}
00106   
00108       int getID() const;
00109       
00111       std::string getName() const;
00112       
00114       bool supports(Feature f) const;
00115       
00117       const utils::Point32f &getCenter2D() const;
00118       
00120       const float &getRotation2D() const;
00121       
00123       const std::vector<utils::Point32f> &getCorners2D() const;
00124   
00126       const std::vector<KeyPoint> &getKeyPoints2D() const;
00127   
00129       const cv::ImageRegion getImageRegion() const;
00130   
00132       const geom::Vec &getCenter3D() const;
00133       
00135       const geom::Vec &getRotation3D() const;
00136       
00138       const geom::Mat &getPose3D() const;    
00139   
00141       inline operator bool() const { return impl; }
00142   
00144       inline bool operator!() const { return isNull(); }
00145   
00147       inline bool isNull() const { return !impl; }
00148   
00150       inline bool operator==(const Fiducial &a) const { return impl == a.impl; }
00151   
00153       inline bool operator!=(const Fiducial &a) const{ return impl != a.impl; }
00154       
00156       inline FiducialImpl *getImpl() { return impl; }
00157   
00159       inline const FiducialImpl *getImpl() const { return impl; }
00160       
00162       FiducialDetectorPlugin *getDetector();
00163   
00165       const FiducialDetectorPlugin *getDetector() const;
00166     };
00167     
00168     
00170     inline Fiducial::FeatureSet operator|(Fiducial::FeatureSet s, Fiducial::Feature f){
00171       s.set(f); return s;
00172     }
00173   
00175     inline Fiducial::FeatureSet operator|(Fiducial::Feature f, Fiducial::FeatureSet s){
00176       return s|f;
00177     }
00178   
00180     inline Fiducial::FeatureSet operator|(Fiducial::Feature f1, Fiducial::Feature f2){
00181       Fiducial::FeatureSet s; s.reset(); s.set(f1); s.set(f2); return s;
00182     }
00183   } // namespace markers
00184 }
00185 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines