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

# Modules/ImageProcessor/VLCImageProcessor/VLCCenterCircleFinder.h

Go to the documentation of this file.

    00001
    00002 #ifndef _VLCCenterCircleFinder_h_
    00003 #define _VLCCenterCircleFinder_h_
    00004
    00005 #include "Tools/Math/Vector2.h"
    00006 #include "Representations/Perception/Image.h"
    00007 #include "Tools/Math/Geometry.h"
    00008 #include "Representations/Perception/CameraMatrix.h"
    00009
    00010 class VLCCenterCircleFinder
    00011 {
    00012 public:
    00013   enum{
    00014       maxNumber = 50,         //size of the array candidatePoints
    00015       mergeDistance = 30,     //2 candidates, which have got a distance smaller than 30mm, will be merged--> take average of the points
    00016       houghDimensionX = 120,  //size of the 2-dim. array houghSpace in x-direction
    00017       houghDimensionY = 50,   //size of the 2-dim. array houghSpace in y-direction
    00018       radius = 32400,         //the radius of the center-circle in [mm^2]
    00019       areaOfInterestX = 2400, //areaOfInterest defines the area (relative to the robot) around the center-circle. this area will be divided
    00020       areaOfInterestY = 1000, //through a grid of the size: houghDimensionX * houghDimensionY (both in [mm])
    00021       aMaxEntry = 6,          //the minimum number of entries in a houghSpace-cell needed, in order to be able to assume that the
    00022                               //coordinates of the cell (x,y) is the midpoint of the center-circle.
    00023       mEntry = 6              //aMaxEntry is the absolute-maximum-entry(only one candidate with the maximum value)
    00024                               //and mEntry is the maximumEntry(more than one candidate with the maximum value)
    00025       };
    00026
    00027
    00028
    00029   VLCCenterCircleFinder(const CameraMatrix& cMatrix, const Image& im);
    00030
    00031   //reset: set numberOfCandidates to zero, initialize houghSpace and flagY
    00032   void reset();
    00033
    00034   //candidates which are inside the area of interest, will be added to the array candidatePoints
    00035   void addCandidate(Vector2<int>& candiOnField, Vector2<int>& candiOfImage);
    00036
    00037   //determineCirclePoint() uses Hough-Transformation, in order to determine the midpoint of the center-circle
    00038   void determineCirclePoint();
    00039
    00040   bool circleFound;
    00041   Vector2<double> midPoint;
    00042   bool getCircle(Vector2<double>& mid);
    00043
    00044
    00045
    00046 private:
    00047   struct Candidate
    00048   {
    00049     Vector2<double> pointOnField;
    00050     Vector2<int> pointOfImage;
    00051   };
    00052
    00053   //candidatePoints manages the possible center-circle candidates
    00054   Candidate candidatePoints[maxNumber];
    00055
    00056   //circlePoints will be initialized with true. a cell circlePoints[i] will be set to false, if the candidate in candidatePoints[i] for sure
    00057   //is not a candidate
    00058   bool circlePoints[maxNumber];
    00059
    00060   //number of entries in candidatePoints
    00061   int numberOfCandidates;
    00062
    00063   //the grid that will divide the area of interest. itīs origin (houghDimension[0][0]) is at the coordinates:
    00064   //houghDimensionX/2, houghDimensionY/2
    00065   int houghSpace[houghDimensionX][houghDimensionY];
    00066
    00067   //flagY[i] marks, if there an entry in the 2-dim. array houghSpace[houghDimensionX][i] is made, so that not the whole area of interest has
    00068   //to be checked for maximum entries
    00069   bool flagY[houghDimensionY];
    00070
    00071   //houghStepX = areaOfInterestX / houghDimensionX, so the areaOfInterestX should be divisible through houghStepX.
    00072   //Quantization error = houghStepX/2
    00073   int houghStepX;
    00074   int houghStepY;
    00075
    00076
    00077   //transforms the indices of the array houghSpace to corresponding field-coordinates.
    00078   //@xDirection: xDirection is true, if arrayIndex is a x-index
    00079   //@fieldPosition: that is calculated field-position
    00080   void transformArrayToField(int arrayIndex, bool xDirection, int& fieldPosition);
    00081
    00082   //transforms the field-position inside the area of interest to the correspoinding array-index.
    00083   //@xDirection: xDirection is true, if arrayIndex is a x-index
    00084   //@arrayIndex: that is the calculated array-index
    00085   void transformFieldToArray(double fieldPos, bool xDirection, int& arrayIndex);
    00086
    00087   //cameraMatrix and image will only be used, in order to transform the results from field-coordinates to image-coordinates, which will
    00088   //display the result
    00089   const CameraMatrix& cameraMatrix;
    00090   const Image& image;
    00091
    00092
    00093
    00094
    00095
    00096
    00097
    00098
    00099
    00100 };
    00101
    00102
    00103 #endif //_VLCCenterCircleFinder_h_
    00104
    00105
    00106
    00107