Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

TagDetection.h

Go to the documentation of this file.
00001 #ifndef TAGDETECTION_H
00002 #define TAGDETECTION_H
00003 
00004 #include "Shared/fmat.h"
00005 #include "Shared/newmat/newmat.h"
00006 #include "Shared/newmat/newmatap.h"
00007 #include "Shared/Measures.h"
00008 #include <utility>
00009 #include <vector>
00010 
00011 namespace AprilTags {
00012 
00013 struct TagDetection {
00014 
00015   //! Constructor
00016   TagDetection();
00017 
00018   //! Constructor for manually creating tags in a world map
00019   TagDetection(int id);
00020 
00021   //! Is the detection good enough?
00022   bool good;
00023 
00024   //! Observed code
00025   long long obsCode;
00026 
00027   //! Matched code
00028   long long code;
00029 
00030   //! What was the ID of the detected tag?
00031   int id;
00032 
00033   //! The hamming distance between the detected code and the true code
00034   int hammingDistance;
00035   
00036   //! How many 90 degree rotations were required to align the code (internal use only)
00037   int rotation;
00038 
00039   /////////////// Fields below are filled in by TagDetector ///////////////
00040   //! Position (in fractional pixel coordinates) of the detection.
00041   /*  The points travel counter-clockwise around the target, always
00042    *  starting from the same corner of the tag.
00043    */
00044   std::pair<float,float> p[4];
00045 
00046   //! Center of tag in pixel coordinates.
00047   std::pair<float,float> cxy;
00048 
00049   //! Measured in pixels, how long was the observed perimeter.
00050   /*! Observed perimeter excludes the inferred perimeter which is used to connect incomplete quads. */
00051   float observedPerimeter;
00052 
00053   //! A 3x3 homography that computes pixel coordinates from tag-relative coordinates.
00054   /*  Both the input and output coordinates are 2D homogeneous vectors, with y = Hx.
00055    *  'y' are pixel coordinates, 'x' are tag-relative coordinates. Tag coordinates span
00056    *  from (-1,-1) to (1,1). The orientation of the homography reflects the orientation
00057    *  of the target.
00058    */
00059   fmat::Matrix<3,3> homography;
00060 
00061   //! Orientation in the xy plane
00062   AngSignPi getXYOrientation() const;
00063     
00064   fmat::Matrix<4,4> getRotMatrix() const;
00065 
00066   //! The homography is relative to image center, whose coordinates are below.
00067   std::pair<float,float> hxy;
00068 
00069   //! Interpolate point given (x,y) is in tag coordinate space from (-1,-1) to (1,1).
00070   std::pair<float,float> interpolate(float x, float y) const;
00071 
00072   //! Used to eliminate redundant tags
00073   bool overlapsTooMuch(const TagDetection &other) const;
00074 };
00075 
00076 } // namespace
00077 
00078 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:51 2016 by Doxygen 1.6.3