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

Modules/ImageProcessor/VLCImageProcessor/VLCBeaconDetector.h

Go to the documentation of this file.
00001 /**
00002 * @file VLCBeaconDetector.h
00003 * 
00004 * Declaration of class VLCBeaconDetector.
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 VLCBeaconDetector_h_
00011 #define VLCBeaconDetector_h_
00012 
00013 #include "Tools/Math/Vector2.h"
00014 #include "Tools/Math/Matrix2x2.h"
00015 #include "VLCFlagSpecialist.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 VLCBeaconDetector
00024 *
00025 * A class for detecting beacons in images
00026 */
00027 class VLCBeaconDetector
00028 {
00029 public:
00030   
00031   enum {edgeThresholdU = 13, edgeThresholdV = 15};
00032 
00033   /** Constructor */ 
00034   VLCBeaconDetector(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   // for VLC
00048   void setBestColorTable(ColorTable * newBestColorTable)
00049   {
00050     bestColorTable = newBestColorTable;
00051     flagSpecialist.setBestColorTable(newBestColorTable);
00052 
00053     // analyse colortable
00054     Vector3<int> nearPoint,farPoint;
00055     ((ColorTable64&) (*bestColorTable)).getBoxAroundColorClass(pink,nearPoint,farPoint);
00056     minPinkUValue = nearPoint.y;
00057   }
00058   //
00059 
00060 private:
00061   
00062   /** Edge detection operators (U and V components) used to find the boundaries of flags*/
00063   const SUSANEdgeDetectionLite edgeDetectionU;
00064   const SUSANEdgeDetectionLite edgeDetectionV;
00065 
00066   /** The image*/
00067   const Image& image;
00068   /** The camera matrix*/
00069   const CameraMatrix& cameraMatrix;
00070   /** The previous camera matrix*/
00071   const CameraMatrix& prevCameraMatrix;
00072   /** Additional Image information*/
00073   const ImageInfo& imageInf;
00074   /** The color table*/
00075   const ColorTable& colorTable;
00076   /** The landmarks percept*/
00077   LandmarksPercept& landmarksPercept;
00078   /** The number of possible beacons*/
00079   int numOfBeaconCandidates;
00080   /** The list of candidates*/
00081   Run beaconCandidates[MAX_NUMBER_OF_PINK_RUNS];
00082   /** A buffer for transformed candidates*/
00083   TransformedRun transformedCandidates[MAX_NUMBER_OF_PINK_RUNS];
00084   /** The base offset for horizontal scan lines*/
00085   const double horizontalBaseOffset;
00086   /** The number of horizontal scan lines above the horizon*/
00087   const int numOfHorizontalScanLineAbove;
00088   /** The number of horizontal scan lines below the horizon*/
00089   const int numOfHorizontalScanLineBelow;
00090   /** The growth factor of the distance between two scan lines*/
00091   const double horizontalOffsetModifier;
00092   /** The maximum distance between the merged runs*/
00093   const int clusteringDistanceTolerance;
00094   /** The minimum length of a pink run*/
00095   const int minPinkRunLength;
00096   /** The maximum vertical distance of scanlines to be clustered, over the 
00097   * estimated merged horizontal distance (half beacon aspect ratio should be 1:1) */
00098   const double clusteringAspectRatio;
00099   /** The minimum value for the ratio of the 2 dimensions of the pink part of
00100   * the beacon, to be used for projection on the unknown colored part*/
00101   const double projectionAspectRatio;
00102   /** The maximum number of pixels which are examined after an edge response has been found
00103   * for determining the color beyond the edge*/
00104   const int edgeScanDepth;
00105   /** The minimum U channel value of a pink pixel*/
00106   unsigned char minPinkUValue;
00107   /** A confidence threshold used to determine if a target beacon, whose type is
00108   not completely clear, can be accepted or not */
00109   const double minFlagConfidence;
00110   /** A flag specialist*/
00111   VLCFlagSpecialist flagSpecialist;
00112   /** The color corrector*/
00113   const ColorCorrector& colorCorrector;
00114 
00115   /** Adds a pink run to the list of candidates
00116   * @param pinkRun A pink run
00117   * @return true, if the run has been appended
00118   */
00119   bool addCandidate(const Run& pinkRun);
00120 
00121   /** Scans along a line*/ 
00122   void scanForPink(const Vector2<int>& start, const Vector2<int>& end);
00123 
00124   /** Scans for one other beacon part*/
00125   bool scanForBeaconPart(const Vector2<int>& start, const Vector2<int>& end,
00126                          Vector2<int>& position, Vector2<int>& edge, colorClass& color); 
00127 
00128   /** Clusters the pink elements to find the pink beacon parts*/
00129   void clusterPinkBeaconParts();
00130 
00131   /** Tries to detect a beacon near a pink part*/
00132   void analyzeBeacon(const Vector2<double>& left, const double pinkRunWidth);
00133   
00134   /** Looks for the vertical edges and the color type of a beacon */
00135   int scanForBeaconEdges(const Vector2<int>& position, const double pinkRunWidth,  
00136         Flag::FlagType& flagType, Vector2<int>& topEdge, Vector2<int>& bottomEdge);
00137 
00138   enum {lowReliability = 1, mediumReliability = 4, highReliability = 6};
00139   
00140   // for VLC
00141   ColorTable * bestColorTable;
00142   //
00143 };
00144 
00145 #endif //VLCBeaconDetector_h_

Generated on Mon Mar 20 21:59:52 2006 for GT2005 by doxygen 1.3.6