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

Tekkotsu v5.1CVS
Generated Fri Mar 16 05:26:53 2012 by Doxygen 1.6.3