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

# Modules/ImageProcessor/SlamImageProcessor/SlamFlagSpecialist.h

Go to the documentation of this file.

    00001 /**
    00002 * @file SlamFlagSpecialist.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 __SlamFlagSpecialist_h_
    00009 #define __SlamFlagSpecialist_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 SlamFlagSpecialist searches for
    00020 * flag landmarks starting at a point in an Image determined before
    00021 */
    00022 class SlamFlagSpecialist
    00023 {
    00024 public:
    00025   SlamFlagSpecialist(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 private:
    00049   const ColorCorrector& colorCorrector;
    00050
    00051   int imageWidth;
    00052   int imageHeight;
    00053
    00054 // search for flags variables
    00055   Vector2<int> north;
    00056   Vector2<int> east;
    00057   Vector2<int> south;
    00058   Vector2<int> west;
    00059   Vector2<int>start;
    00060   Vector2<int>destination;
    00061
    00062   void estimateOffsetForFlags(
    00063    LandmarksPercept& landmarksPercept,
    00064    const Vector2<double>& cameraOffset
    00065    );
    00066
    00067   enum {maxNumberOfBoundingBoxes = 6};
    00068   enum {numberOfHorizontalScans = 5, numberOfVerticalScans = 3};
    00069
    00070   double boundingBoxTop[maxNumberOfBoundingBoxes][6];
    00071   double boundingBoxBottom[maxNumberOfBoundingBoxes][6];
    00072   double boundingBoxLeft[maxNumberOfBoundingBoxes][6];
    00073   double boundingBoxRight[maxNumberOfBoundingBoxes][6];
    00074
    00075   bool boundingBoxTopValid[maxNumberOfBoundingBoxes][6];
    00076   bool boundingBoxBottomValid[maxNumberOfBoundingBoxes][6];
    00077   bool boundingBoxLeftValid[maxNumberOfBoundingBoxes][6];
    00078   bool boundingBoxRightValid[maxNumberOfBoundingBoxes][6];
    00079
    00080   int numberOfBoundingBoxes[6];
    00081
    00082   int bestBoundingBox[6];
    00083
    00084   enum Direction{up, down, left, right};
    00085   enum DebugType{initial, vertical, horizontal};
    00086
    00087   bool findEndOfFlag(
    00088     const Image& image,
    00089   const CameraInfo& bwCameraInfo,
    00090     const ColorTable& colorTable,
    00091     const Vector2<int> start,
    00092     Vector2<double> horizonDirection,
    00093     Direction direction,
    00094     Vector2<int>& destination,
    00095     colorClass color,
    00096     bool pinkIsTop,
    00097     bool startIsInTop,
    00098     DebugType type,
    00099     int& countPixel,
    00100     int& countTop,
    00101     int& countBottom
    00102     );
    00103
    00104 public:
    00105   /** Used for visualization of the flag scans*/
    00106   DECLARE_DEBUG_IMAGE(imageProcessorFlags);
    00107 };
    00108
    00109
    00110 #endif// __SlamFlagSpecialist_h_