CrossRecognizer.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef CROSS_RECOGNIZER_DEFINED
00038 #define CROSS_RECOGNIZER_DEFINED
00039
00040 #include "GUI/XWinManaged.H"
00041 #include "Image/Image.H"
00042 #include "Image/Pixels.H"
00043 #include "Util/Types.H"
00044 #include "Util/log.H"
00045 #include "Image/DrawOps.H"
00046
00047 #include "MBARI/Geometry2D.H"
00048 #include "Image/OpenCVUtil.H"
00049 #include "Image/ColorOps.H"
00050
00051 #define LINESCALE 80
00052
00053 class CrossRecognizer
00054 {
00055 public:
00056
00057
00058
00059
00060
00061
00062 CrossRecognizer();
00063
00064
00065 ~CrossRecognizer();
00066
00067
00068
00069
00070
00071
00072
00073 enum CrossRecognizeMethod { HOUGH, SOMETHING, SOMETHING_ELSE };
00074
00075
00076
00077
00078
00079
00080
00081 void getCrossLocation (rutz::shared_ptr<Image<byte> > colorSegmentedImage,
00082 rutz::shared_ptr<Image<PixRGB <byte> > > outputImage,
00083 CrossRecognizeMethod method,
00084 rutz::shared_ptr<Point2D<int> > crossCenterPoint,
00085 rutz::shared_ptr<float> crossAngle,
00086 rutz::shared_ptr<uint> stalePointCount
00087 );
00088
00089
00090 private:
00091 void calculateHoughTransform(rutz::shared_ptr<Image<byte> > colorSegmentedImage,
00092 rutz::shared_ptr<Image<PixRGB<byte> > > outputImage,
00093 rutz::shared_ptr<Point2D<int> > crossCenterPoint,
00094 rutz::shared_ptr<float> crossAngle,
00095 rutz::shared_ptr<uint> stalePointCount
00096 );
00097
00098 Point2D<int> getCrossCenter(const std::vector<LineSegment2D> lines,
00099 std::vector<LineSegment2D> ¢erPointLines,
00100 rutz::shared_ptr<uint> stalePointCount
00101 );
00102
00103 std::vector<LineSegment2D> getHoughLines(rutz::shared_ptr< Image< byte > > colorSegmentedImage,
00104 rutz::shared_ptr< Image< PixRGB <byte> > > outputImage);
00105
00106 std::vector<LineSegment2D> pruneLines (const std::vector<LineSegment2D> lineSegments);
00107
00108 float getCrossDir(const std::vector<LineSegment2D> lines);
00109
00110 std::list<Point2D<int> > centerPointBuff;
00111 std::list<float> angleBuff;
00112
00113 int houghThreshold;
00114 int minThreshold;
00115 int maxThreshold;
00116 float sigma;
00117 float tlow;
00118 float thigh;
00119 float linescale;
00120 int foundCount;
00121 int avgCrossCenterX;
00122 int avgCrossCenterY;
00123 float avgCrossAngle;
00124 float stdDevCrossX;
00125 float stdDevCrossY;
00126 float stdDevCrossAngle;
00127
00128 uint stdDevAngleCount;
00129 uint stdDevCenterCount;
00130
00131 bool itsSetupOrangeTracker;
00132
00133
00134 };
00135
00136 #endif
00137
00138
00139
00140
00141
00142
00143