| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
Quad.hGo to the documentation of this file.00001 #ifndef QUAD_H 00002 #define QUAD_H 00003 00004 #include <utility> 00005 #include <vector> 00006 00007 #include "Shared/fmat.h" 00008 #include "Homography33.h" 00009 00010 namespace AprilTags { 00011 00012 class FloatImage; 00013 class Segment; 00014 00015 using std::min; 00016 using std::max; 00017 00018 //! Represents four segments that form a loop, and might be a tag. 00019 class Quad { 00020 public: 00021 static const int minimumEdgeLength = 6; //!< Minimum size of a tag (in pixels) as measured along edges and diagonals 00022 static float const maxQuadAspectRatio; //!< Early pruning of quads with insane ratios. 00023 00024 //! Constructor 00025 /*! (x,y) are the optical center of the camera, which is 00026 * needed to correctly compute the homography. */ 00027 Quad(const std::vector< std::pair<float,float> >& p, const std::pair<float,float>& opticalCenter); 00028 00029 //! Interpolate given that the lower left corner of the lower left cell is at (-1,-1) and the upper right corner of the upper right cell is at (1,1). 00030 std::pair<float,float> interpolate(float x, float y); 00031 00032 //! Same as interpolate, except that the coordinates are interpreted between 0 and 1, instead of -1 and 1. 00033 std::pair<float,float> interpolate01(float x, float y); 00034 00035 //! Points for the quad (in pixel coordinates), in counter clockwise order. These points are the intersections of segments. 00036 std::vector< std::pair<float,float> > quadPoints; 00037 00038 //! Segments composing this quad 00039 std::vector<Segment*> segments; 00040 00041 //! Total length (in pixels) of the actual perimeter observed for the quad. 00042 /*! This is in contrast to the geometric perimeter, some of which 00043 * may not have been directly observed but rather inferred by 00044 * intersecting segments. Quads with more observed perimeter are 00045 * preferred over others. */ 00046 float observedPerimeter; 00047 00048 //! Given that the whole quad spans from (0,0) to (1,1) in "quad space", compute the pixel coordinates for a given point within that quad. 00049 /*! Note that for most of the Quad's existence, we will not know the correct orientation of the tag. */ 00050 Homography33 homography; 00051 00052 //! Searches through a vector of Segments to form Quads. 00053 /* @param quads any discovered quads will be added to this list 00054 * @param path the segments currently part of the search 00055 * @param parent the first segment in the quad 00056 * @param depth how deep in the search are we? 00057 */ 00058 static void search(const FloatImage& fImage, std::vector<Segment*>& path, 00059 Segment& parent, int depth, std::vector<Quad>& quads); 00060 00061 }; 00062 00063 } // namespace 00064 00065 #endif |
|
Tekkotsu v5.1CVS |
Generated Fri Mar 16 05:26:50 2012 by Doxygen 1.6.3 |