Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Modules/ImageProcessor/GT2005ImageProcessor/GT2005BeaconDetector.h

Go to the documentation of this file.

    00001 /**
    00002 * @file GT2005BeaconDetector.h
    00003 *
    00004 * Declaration of class GT2005BeaconDetector.
    00005 *
    00006 * @author <a href="mailto:timlaue@tzi.de">Tim Laue</a>
    00007 * @author <a href="mailto:walter.nistico@uni-dortmund.de">Walter Nistico</a>
    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 * @class GT2005BeaconDetector
    00024 *
    00025 * A class for detecting beacons in images
    00026 */
    00027 class GT2005BeaconDetector
    00028 {
    00029 public:
    00030
    00031   enum {edgeThresholdU = 13, edgeThresholdV = 15};
    00032
    00033   /** Constructor */
    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   /** Executes the beacon detection*/
    00042   void execute();
    00043
    00044   /** Gains information about pink from the current color table*/
    00045   void analyzeColorTable();
    00046
    00047 private:
    00048
    00049   /** Edge detection operators (U and V components) used to find the boundaries of flags*/
    00050   const SUSANEdgeDetectionLite edgeDetectionU;
    00051   const SUSANEdgeDetectionLite edgeDetectionV;
    00052
    00053   /** The image*/
    00054   const Image& image;
    00055   /** The camera matrix*/
    00056   const CameraMatrix& cameraMatrix;
    00057   /** The previous camera matrix*/
    00058   const CameraMatrix& prevCameraMatrix;
    00059   /** Additional Image information*/
    00060   const ImageInfo& imageInf;
    00061   /** The color table*/
    00062   const ColorTable& colorTable;
    00063   /** The landmarks percept*/
    00064   LandmarksPercept& landmarksPercept;
    00065   /** The number of possible beacons*/
    00066   int numOfBeaconCandidates;
    00067   /** The list of candidates*/
    00068   Run beaconCandidates[MAX_NUMBER_OF_PINK_RUNS];
    00069   /** A buffer for transformed candidates*/
    00070   TransformedRun transformedCandidates[MAX_NUMBER_OF_PINK_RUNS];
    00071   /** The base offset for horizontal scan lines*/
    00072   const double horizontalBaseOffset;
    00073   /** The number of horizontal scan lines above the horizon*/
    00074   const int numOfHorizontalScanLineAbove;
    00075   /** The number of horizontal scan lines below the horizon*/
    00076   const int numOfHorizontalScanLineBelow;
    00077   /** The growth factor of the distance between two scan lines*/
    00078   const double horizontalOffsetModifier;
    00079   /** The maximum distance between the merged runs*/
    00080   const int clusteringDistanceTolerance;
    00081   /** The minimum length of a pink run*/
    00082   const int minPinkRunLength;
    00083   /** The maximum vertical distance of scanlines to be clustered, over the
    00084   * estimated merged horizontal distance (half beacon aspect ratio should be 1:1) */
    00085   const double clusteringAspectRatio;
    00086   /** The minimum value for the ratio of the 2 dimensions of the pink part of
    00087   * the beacon, to be used for projection on the unknown colored part*/
    00088   const double projectionAspectRatio;
    00089   /** The maximum number of pixels which are examined after an edge response has been found
    00090   * for determining the color beyond the edge*/
    00091   const int edgeScanDepth;
    00092   /** The minimum U channel value of a pink pixel*/
    00093   unsigned char minPinkUValue;
    00094   /** A confidence threshold used to determine if a target beacon, whose type is
    00095   not completely clear, can be accepted or not */
    00096   const double minFlagConfidence;
    00097   /** A flag specialist*/
    00098   GT2005FlagSpecialist flagSpecialist;
    00099   /** The color corrector*/
    00100   const ColorCorrector& colorCorrector;
    00101
    00102   /** Adds a pink run to the list of candidates
    00103   * @param pinkRun A pink run
    00104   * @return true, if the run has been appended
    00105   */
    00106   bool addCandidate(const Run& pinkRun);
    00107
    00108   /** Scans along a line*/
    00109   void scanForPink(const Vector2<int>& start, const Vector2<int>& end);
    00110
    00111   /** Scans for one other beacon part*/
    00112   bool scanForBeaconPart(const Vector2<int>& start, const Vector2<int>& end,
    00113                          Vector2<int>& position, Vector2<int>& edge, colorClass& color);
    00114
    00115   /** Clusters the pink elements to find the pink beacon parts*/
    00116   void clusterPinkBeaconParts();
    00117
    00118   /** Tries to detect a beacon near a pink part*/
    00119   void analyzeBeacon(const Vector2<double>& left, const double pinkRunWidth);
    00120
    00121   /** Looks for the vertical edges and the color type of a beacon */
    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_