00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef GT2005BeaconDetector_h_
00011 #define GT2005BeaconDetector_h_
00012
00013 #include "Tools/Math/Vector2.h"
00014 #include "Tools/Math/Matrix2x2.h"
00015 #include "GT2005FlagSpecialist.h"
00016 #include "Modules/ImageProcessor/ImageProcessorTools/ImageProcessorUtilityClasses.h"
00017 #include "Modules/ImageProcessor/ImageProcessorTools/SUSANEdgeDetectionLite.h"
00018 #include "Modules/ImageProcessor/ImageProcessorTools/BresenhamLineScan.h"
00019
00020 #define MAX_NUMBER_OF_PINK_RUNS 20
00021
00022
00023
00024
00025
00026
00027 class GT2005BeaconDetector
00028 {
00029 public:
00030
00031 enum {edgeThresholdU = 13, edgeThresholdV = 15};
00032
00033
00034 GT2005BeaconDetector(const Image& image, const CameraMatrix& cameraMatrix,
00035 const CameraMatrix& prevCameraMatrix,
00036 const ImageInfo& imageInf,
00037 const ColorTable& colorTable,
00038 const ColorCorrector& colorCorrector,
00039 LandmarksPercept& landmarksPercept);
00040
00041
00042 void execute();
00043
00044
00045 void analyzeColorTable();
00046
00047 private:
00048
00049
00050 const SUSANEdgeDetectionLite edgeDetectionU;
00051 const SUSANEdgeDetectionLite edgeDetectionV;
00052
00053
00054 const Image& image;
00055
00056 const CameraMatrix& cameraMatrix;
00057
00058 const CameraMatrix& prevCameraMatrix;
00059
00060 const ImageInfo& imageInf;
00061
00062 const ColorTable& colorTable;
00063
00064 LandmarksPercept& landmarksPercept;
00065
00066 int numOfBeaconCandidates;
00067
00068 Run beaconCandidates[MAX_NUMBER_OF_PINK_RUNS];
00069
00070 TransformedRun transformedCandidates[MAX_NUMBER_OF_PINK_RUNS];
00071
00072 const double horizontalBaseOffset;
00073
00074 const int numOfHorizontalScanLineAbove;
00075
00076 const int numOfHorizontalScanLineBelow;
00077
00078 const double horizontalOffsetModifier;
00079
00080 const int clusteringDistanceTolerance;
00081
00082 const int minPinkRunLength;
00083
00084
00085 const double clusteringAspectRatio;
00086
00087
00088 const double projectionAspectRatio;
00089
00090
00091 const int edgeScanDepth;
00092
00093 unsigned char minPinkUValue;
00094
00095
00096 const double minFlagConfidence;
00097
00098 GT2005FlagSpecialist flagSpecialist;
00099
00100 const ColorCorrector& colorCorrector;
00101
00102
00103
00104
00105
00106 bool addCandidate(const Run& pinkRun);
00107
00108
00109 void scanForPink(const Vector2<int>& start, const Vector2<int>& end);
00110
00111
00112 bool scanForBeaconPart(const Vector2<int>& start, const Vector2<int>& end,
00113 Vector2<int>& position, Vector2<int>& edge, colorClass& color);
00114
00115
00116 void clusterPinkBeaconParts();
00117
00118
00119 void analyzeBeacon(const Vector2<double>& left, const double pinkRunWidth);
00120
00121
00122 int scanForBeaconEdges(const Vector2<int>& position, const double pinkRunWidth,
00123 Flag::FlagType& flagType, Vector2<int>& topEdge, Vector2<int>& bottomEdge);
00124
00125 enum {lowReliability = 1, mediumReliability = 4, highReliability = 6};
00126 };
00127
00128 #endif //GT2005BeaconDetector_h_