Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Segment.h

Go to the documentation of this file.
00001 #ifndef SEGMENT_H
00002 #define SEGMENT_H
00003 
00004 #include <cmath>
00005 #include <vector>
00006 
00007 namespace AprilTags {
00008 
00009 //! Represents a line fit to a set of pixels whose gradients are similiar.
00010 class Segment {
00011 public:
00012   Segment();
00013 
00014   static int const minimumSegmentSize = 4; //!< Minimum number of pixels in a segment before we'll fit a line to it.
00015   static float const minimumLineLength; //!< In pixels. Calculated based on minimum plausible decoding size for Tag9 family.
00016 
00017   float getX0() const { return x0; }
00018   void setX0(float newValue) { x0 = newValue; }
00019 
00020   float getY0() const { return y0; }
00021   void setY0(float newValue) { y0 = newValue; }
00022 
00023   float getX1() const { return x1; }
00024   void setX1(float newValue) { x1 = newValue; }
00025 
00026   float getY1() const { return y1; }
00027   void setY1(float newValue) { y1 = newValue; }
00028 
00029   float getTheta() const { return theta; }
00030   void setTheta(float newValue) { theta = newValue; }
00031 
00032   float getLength() const { return length; }
00033   void setLength(float newValue) { length = newValue; }
00034 
00035   //! Returns the length of the Segment.
00036   float segmentLength();
00037 
00038   //! Print endpoint coordinates of this segment.
00039   void printSegment();
00040 
00041   //! ID of Segment.
00042   int getId() const { return segmentId; }
00043 
00044   std::vector<Segment*> children;
00045 
00046 private:
00047   float x0, y0, x1, y1;
00048   float theta; // gradient direction (points towards white)
00049   float length; // length of line segment in pixels
00050   int segmentId;
00051   static int idCounter;
00052 };
00053 
00054 } // namsepace
00055 
00056 #endif

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