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

# Modules/ImageProcessor/VLCImageProcessor/VLCFlagSpecialist.h

Go to the documentation of this file.

    00001 /**
    00002 * @file VLCFlagSpecialist.h
    00003 *
    00004 * This file contains a class for Image Processing.
    00005 * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Juengel</A>
    00006 */
    00007
    00008 #ifndef __VLCFlagSpecialist_h_
    00009 #define __VLCFlagSpecialist_h_
    00010
    00011 #include "Tools/Debugging/DebugImages.h"
    00012
    00013 #include "Representations/Perception/ColorTable.h"
    00014 #include "Representations/Perception/LandmarksPercept.h"
    00015 #include "Representations/Perception/CameraMatrix.h"
    00016 #include "Tools/Math/Geometry.h"
    00017
    00018 /**
    00019 * As part of the GridImageProcessor the VLCFlagSpecialist searches for
    00020 * flag landmarks starting at a point in an Image determined before
    00021 */
    00022 class VLCFlagSpecialist
    00023 {
    00024 public:
    00025   VLCFlagSpecialist(const ColorCorrector&);
    00026
    00027   /** Initializes the flag specialist.*/
    00028   void init(const Image& image);
    00029
    00030   /** Searches for the flag in the image, starting from the specified point. */
    00031   void searchFlags(
    00032     const Image& image,
    00033     const ColorTable& colorTable,
    00034     const CameraMatrix& cameraMatrix,
    00035     colorClass color,
    00036     bool pinkIsTop,
    00037     const Geometry::Line horizonLine,
    00038     int x, int y);
    00039
    00040   void getFlagPercept(
    00041     const CameraMatrix& cameraMatrix,
    00042     const CameraMatrix& prevCameraMatrix,
    00043     const CameraInfo& cameraInfo,
    00044     const Geometry::Line horizonLine,
    00045     LandmarksPercept& landmarksPercept
    00046     );
    00047
    00048   // for VLC
    00049   void setBestColorTable(ColorTable * newBestColorTable)
    00050   {
    00051     bestColorTable = newBestColorTable;
    00052   }
    00053   //
    00054
    00055 private:
    00056   const ColorCorrector& colorCorrector;
    00057
    00058   int imageWidth;
    00059   int imageHeight;
    00060
    00061 // search for flags variables
    00062   Vector2<int> north;
    00063   Vector2<int> east;
    00064   Vector2<int> south;
    00065   Vector2<int> west;
    00066   Vector2<int>start;
    00067   Vector2<int>destination;
    00068
    00069   void estimateOffsetForFlags(
    00070    LandmarksPercept& landmarksPercept,
    00071    const Vector2<double>& cameraOffset
    00072    );
    00073
    00074   enum {maxNumberOfBoundingBoxes = 6};
    00075   enum {numberOfHorizontalScans = 5, numberOfVerticalScans = 3};
    00076
    00077   double boundingBoxTop[maxNumberOfBoundingBoxes][6];
    00078   double boundingBoxBottom[maxNumberOfBoundingBoxes][6];
    00079   double boundingBoxLeft[maxNumberOfBoundingBoxes][6];
    00080   double boundingBoxRight[maxNumberOfBoundingBoxes][6];
    00081
    00082   bool boundingBoxTopValid[maxNumberOfBoundingBoxes][6];
    00083   bool boundingBoxBottomValid[maxNumberOfBoundingBoxes][6];
    00084   bool boundingBoxLeftValid[maxNumberOfBoundingBoxes][6];
    00085   bool boundingBoxRightValid[maxNumberOfBoundingBoxes][6];
    00086
    00087   int numberOfBoundingBoxes[6];
    00088
    00089   int bestBoundingBox[6];
    00090
    00091   enum Direction{up, down, left, right};
    00092   enum DebugType{initial, vertical, horizontal};
    00093
    00094   bool findEndOfFlag(
    00095     const Image& image,
    00096   const CameraInfo& bwCameraInfo,
    00097     const ColorTable& colorTable,
    00098     const Vector2<int> start,
    00099     Vector2<double> horizonDirection,
    00100     Direction direction,
    00101     Vector2<int>& destination,
    00102     colorClass color,
    00103     bool pinkIsTop,
    00104     bool startIsInTop,
    00105     DebugType type,
    00106     int& countPixel,
    00107     int& countTop,
    00108     int& countBottom
    00109     );
    00110
    00111
    00112   // for VLC
    00113   ColorTable * bestColorTable;
    00114   //
    00115
    00116 public:
    00117   /** Used for visualization of the flag scans*/
    00118   DECLARE_DEBUG_IMAGE(imageProcessorFlags);
    00119 };
    00120
    00121
    00122 #endif// __VLCFlagSpecialist_h_