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

Modules/ImageProcessor/GT2004ImageProcessor/GT2004BeaconDetector.h

Go to the documentation of this file.
00001 /**
00002 * @file GT2004BeaconDetector.h
00003 * 
00004 * Declaration of class GT2004BeaconDetector.
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 GT2004BeaconDetector_h_
00011 #define GT2004BeaconDetector_h_
00012 
00013 #include "Tools/Math/Vector2.h"
00014 #include "Tools/Math/Matrix2x2.h"
00015 #include "GT2004FlagSpecialist.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 GT2004BeaconDetector
00024 *
00025 * A class for detecting beacons in images
00026 */
00027 class GT2004BeaconDetector
00028 {
00029 public:
00030   
00031   enum {edgeThresholdU = 13, edgeThresholdV = 15};
00032 
00033   /** Constructor */ 
00034   GT2004BeaconDetector(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   GT2004FlagSpecialist 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 //GT2004BeaconDetector_h_
00129 
00130 /*
00131 * $Log: GT2004BeaconDetector.h,v $
00132 * Revision 1.12  2004/07/02 10:11:47  nistico
00133 * Cloned main image processor and created
00134 * SpecialLandmarks specialist for SLAM challenge
00135 *
00136 * Revision 1.11  2004/06/12 17:37:00  nistico
00137 * Eventually, would be nice to have only one Bresenham on the whole
00138 * GT2004ImageProcessor
00139 *
00140 * Revision 1.10  2004/06/09 15:04:14  nistico
00141 * Changed distribution of scanlines
00142 * Some cleanup
00143 * Test result positive
00144 *
00145 * Revision 1.9  2004/06/08 16:00:33  nistico
00146 * Final(?) improvement to the beaconSpecialist: 3 or 4 columns (depending on size)
00147 * are always scanned, and the results are merged based on validity, which is
00148 * calculated from the number of edges found and consistency checks
00149 *
00150 * Revision 1.8  2004/06/05 19:48:45  nistico
00151 * Added one more special situation to BeaconDetector
00152 * imageProcessorGradients now visualized edges used by
00153 * BeaconDetector, for debugging
00154 *
00155 * Revision 1.7  2004/06/05 07:58:21  roefer
00156 * Compensation for motion distortions of images
00157 *
00158 * Revision 1.6  2004/06/04 16:07:33  nistico
00159 * AnalyzeBeacon: more special cases added,
00160 * should be (almost) final
00161 *
00162 * Revision 1.5  2004/06/03 15:13:16  nistico
00163 * AnalyzeBeacon further improved, finds more edges and more redundancy checks
00164 * Scanline spacing reviewed
00165 * Non-rotated coordinates bug fixed
00166 *
00167 * Revision 1.3  2004/06/01 13:07:10  nistico
00168 * All Bresenham functionality encapsulated into the proper class
00169 *
00170 * Revision 1.1.1.1  2004/05/22 17:19:42  cvsadm
00171 * created new repository GT2004_WM
00172 *
00173 * Revision 1.3  2004/05/18 18:39:25  nistico
00174 * BeaconDetector improved, the landmarks are recognized much more often,
00175 * and the width is estimated correctly most of the time.
00176 * Some things are still less then ideal, though (i'll post something on the forum),
00177 *
00178 * Revision 1.2  2004/05/14 12:19:24  tim
00179 * fixed bug
00180 *
00181 * Revision 1.1  2004/05/04 13:40:19  tim
00182 * added GT2004ImageProcessor
00183 *
00184 */

Generated on Thu Sep 23 19:57:28 2004 for GT2004 by doxygen 1.3.6