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

Modules/ImageProcessor/RasterImageProcessor/RasterSpecialist.h

Go to the documentation of this file.
00001 /**
00002 * @file RasterSpecialist.h
00003 * 
00004 * This file contains the definition of class RasterSpecialist.
00005 *
00006 * @author <a href="mailto:sadprofessor@web.de">Bernd Schmidt</a>
00007 */
00008 #ifndef RASTERSPECIALIST_H
00009 #define RASTERSPECIALIST_H
00010 
00011 
00012 #include "RasterImageProcessor.h"
00013 #include "Tools/Math/Geometry.h"
00014 #include <list>
00015 #include <vector>
00016 
00017 
00018 /** Relevant directions for scan methods. */
00019 enum RasterDirections{
00020   north = 0,
00021   northEast,
00022   east,
00023   southEast,
00024   south,
00025   southWest,
00026   west,
00027   northWest,
00028   numberOfRasterDirections
00029 };
00030 
00031 /** @class RasterSpecialist 
00032 * Base-class for RasterSpecialists.
00033 * A RasterSpecialist is detecting shapes in the image.
00034 * @author <a href="mailto:sadprofessor@web.de">Bernd Schmidt</a>
00035 */
00036 class RasterSpecialist  
00037 {
00038 public:
00039   struct LinePair;
00040   struct ColoredLP;
00041   struct GridLP;
00042 
00043   /** 
00044   * @class LinePair
00045   * This struct represents a line on the image. It holds also informations 
00046   * about the color and the number of segment it belongs to.
00047   * The segment number is needed for the segmentation algorithms.
00048   */
00049   struct LinePair{
00050     /** Constructor */
00051     LinePair();
00052     /** Constructor 
00053     *
00054     *   @param vec1 The start point.
00055     *   @param vec2 The end point.
00056     */
00057     LinePair(Vector2<int> vec1,Vector2<int> vec2);
00058     /** Constructor 
00059     *
00060     *   @param vec1 The start point.
00061     *   @param vec2 The end point.
00062     *   @param c The color class.
00063     */
00064     LinePair(Vector2<int> vec1,Vector2<int> vec2,colorClass c);
00065     /** The first point.*/
00066     Vector2<int> v1;
00067     /** The second point.*/
00068     Vector2<int> v2;
00069     /** The number of segment.*/
00070     int segment;
00071     /** The color.*/
00072     colorClass color;
00073 
00074     /** Defines the default order for LinePairs.
00075     * order is lexigographical in v1 (v1.y,v1.x).
00076     * @param other The LinePair to be compared.
00077     * @return True if other is greater.
00078     */
00079     bool operator <(const LinePair& other){
00080       return v1.y < other.v1.y || 
00081            v1.y == other.v1.y && v1.x < other.v1.y ;
00082     }
00083   };
00084   
00085   /** @class ColoredLP
00086   *   Four colors for the vector2 begin and end representing in/out colors
00087   *   0 and 1 should be v1-in and v1-out, same for  
00088   *   2 and 3  v2-in and v2-out
00089   */
00090   struct ColoredLP:LinePair{
00091     colorClass inOut[4];
00092   };
00093   
00094   /** @class GridLP 
00095   * Holds also information about the position in a grid. */
00096   struct GridLP:LinePair{
00097     /** The column of the grid.*/
00098     int column;
00099     /** The start point.*/
00100     int d1;
00101     /** The end point.*/
00102     int d2;
00103   };
00104 
00105 
00106   typedef struct{
00107     int operator()(const LinePair& pair1,const LinePair& pair2){
00108       return abs(pair1.v1.x - pair1.v2.x) > abs(pair2.v1.x - pair2.v2.x);
00109     }
00110   }  LineCompare;
00111 
00112   struct ListSizeOrder{
00113     bool operator()(const std::list<LinePair >& l1, const std::list<LinePair >& l2){
00114       return l1.size() < l2.size();
00115     }
00116   };
00117 
00118   struct VectorSizeOrder{
00119     bool operator()(const std::vector<LinePair >& l1, const std::vector<LinePair >& l2){
00120       return l1.size() < l2.size();
00121     }
00122   };
00123 
00124   struct SegmentNumberOrder{
00125     bool operator()(const LinePair& pair1, const LinePair& pair2){
00126       return pair1.segment < pair2.segment;
00127     }
00128   };
00129 
00130   /** @class Box
00131   * This class represents a BoundingBox in the image.
00132   * The box is parallel to the axes of the coordinate-system.
00133   */
00134   class Box{
00135   public:
00136     /** Constructor 
00137     *
00138     *   @param minX
00139     *   @param minY
00140     *   @param maxX
00141     *   @param maxY
00142     */
00143     Box(int minX,int minY,int maxX,int maxY);
00144     
00145     /** Minimal x-coordinate of the box.*/
00146     int minX;
00147     /** Minimal y-coordinate of the box.*/
00148     int minY;
00149     /** Maximal x-coordinate of the box.*/
00150     int maxX;
00151     /** Maximal y-coordinate of the box.*/
00152     int maxY;
00153       
00154     /** After calling this method, this is the union of box and this.
00155     *   @param box input
00156     */
00157     void merge(Box& box){
00158       if (box.minX < minX) minX = box.minX;
00159       if (box.maxX > maxX) maxX = box.maxX;
00160       if (box.minY < minY) minY = box.minY;
00161       if (box.maxY > maxY) maxY = box.maxY;
00162     }
00163     /** Adds a point to the bounding-box. The resulting bounding box is the smallest box
00164     *   that contains (x,y) and this(before adding the point).
00165     *
00166     *   @param x The x coordinate to add.
00167     *   @param y The y coordinate to add.
00168     */
00169     void add(int x,int y){
00170       if (x<minX) minX = x;
00171       else if (x>maxX) maxX = x;
00172       if (y<minY) minY = y;
00173       else if(y>maxY) maxY = y;
00174     }
00175     /** Resets the bounding box. After resetting the bounding box lies at position (x,y)
00176     *   and the width and height of it are 0.
00177     *   
00178     *   @param x The x coordinate.
00179     *   @param y The y coordinate.
00180     */
00181     void reset(int x, int y){
00182       minX = x;
00183       minY = y;
00184       maxX = x;
00185       maxY = y;
00186     }
00187     /** Tests if the bounding box contains the point at position (x,y).
00188     *   
00189     *   @param x The x coordinate.
00190     *   @param y The y coordinate.
00191     *   @return 
00192     */
00193     bool inside(int x, int y){
00194       return (x>=minX && y>=minY && x<=maxX && y<=maxY);
00195     }
00196   };
00197 
00198   
00199   typedef const unsigned char* I_Pin ;
00200   
00201   /** The Constructor. 
00202   * For creation the RasterImageProcessor is needed.
00203   * @param imagePro The ImageProcessor the specialist belongs to.
00204   */
00205   RasterSpecialist(RasterImageProcessor &imagePro);
00206   /** The Destructor. */
00207   virtual ~RasterSpecialist();
00208   
00209   /** getter for the type of specialist 
00210   *   @return The type of the specialist.
00211   */
00212   virtual int getType() = 0;
00213   /** Initializes the specialist before running the detection algorithm. */
00214   virtual void init() = 0;
00215   /** Executes the detection algorithm. */
00216   virtual void executePostProcessing(){/*do nothing*/}
00217   /** Invokes the specialist in the first scan stage at position (x,y)
00218     * (this member should be replaced later).
00219     *   @param x The x coordinate.
00220     *   @param y The y coordinate.
00221     */
00222   virtual void invokeOnPreScan(int x, int y){/*do nothing*/}
00223   /** Invokes the specialist in the second scan stage at position (x,y) 
00224     * (this member should be replaced later).
00225     *   @param x The x coordinate.
00226     *   @param y The y coordinate.  
00227     */
00228   virtual void invokeOnPostScan(int x, int y){/*do nothing*/}
00229 
00230   /** Tells if the specialist should be invoked in the pre-scan. */
00231   bool preScanNeeded;
00232   /** Tells if the specialist should be invoked in the post-scan.*/
00233   bool postScanNeeded;
00234 
00235 protected:  
00236   /** Holds the related image processor.*/
00237   RasterImageProcessor *rip;
00238   /** Holds the height of the image.*/
00239   int const imageHeight;
00240   /** Holds the width of the image.*/
00241   int const imageWidth;
00242   /** A helper variable */
00243   Vector2<int> errorDummy;
00244   
00245   /** Runs a algorithm to cluster line pairs that might belong
00246   * to one region (segment).
00247   * 
00248   * preconstraint: Lines must be sorted in increasing x - order
00249   *
00250   * @param lines The lines to cluster.
00251   * @param segments The output as a vector.
00252   * @param spaceX Allowed space between two pairs in x-dimension.
00253   * @param spaceY Allowed space between two pairs in y-direction.
00254   */
00255   void createSegmentsFromLines(std::list<LinePair>& lines,
00256     std::vector<std::list<LinePair> >& segments,int spaceX,int spaceY);
00257   /** Runs a algorithm to cluster line pairs that might belong
00258   *   to one region (segment).
00259   * 
00260   *   preconstraint: Lines must be sorted in increasing y - order
00261   *
00262   *   @param lines The lines to cluster.
00263   *   @param segments The output as a vector.
00264   *   @param xSpace Allowed space between two pairs in x-dimension.
00265   *   @param ySpace Allowed space between two pairs in y-direction.
00266   *   @return 
00267   */
00268   bool createSegmentsFromLines2(std::list<LinePair>& lines,
00269     std::vector<std::list<LinePair> >& segments,int xSpace, int ySpace);
00270   /** Runs a algorithm to cluster GridLPs that might belong
00271   *   to one region (segment). The segmantation process is calculated
00272   *   in the coordinate system of the grid.
00273   *   
00274   *   preconstraint: Lines must be sorted in increasing y - order
00275   *
00276   *   @param lines The lines to cluster.
00277   *   @param segments The output as a vector.
00278   *   @param xSpace Allowed space between two pairs in x-dimension.
00279   *   @param ySpace Allowed space between two pairs in y-direction.
00280   *   @return 
00281   */
00282   bool createGridSegments(std::list<GridLP>& lines,
00283     std::vector<std::list<GridLP> >& segments,int xSpace, int ySpace);
00284 
00285   /** Runs a algorithm to cluster line pairs that might belong
00286   *   to one region (segment). Two line pairs only will belong to one 
00287   *   region, if the color of the two line pairs is the same.
00288   * 
00289   *   preconstraint: Lines must be sorted in increasing y - order
00290   *
00291   *   @param lines The lines to cluster.
00292   *   @param segments The output as a vector.
00293   *   @param xSpace Allowed space between two pairs in x-dimension.
00294   *   @param ySpace Allowed space between two pairs in y-direction.
00295   *   @return 
00296   */
00297   bool doColorSegmentation(std::vector<LinePair>& lines,
00298     std::vector<std::vector<LinePair> >& segments,int xSpace,int ySpace);
00299   /** precondition: Lines must be sorted in increasing y - order. 
00300   *
00301   *   @param input A region.
00302   *   @param output A vector of points, that represents the polygon.
00303   */
00304   void createConvexPoly(std::list<LinePair>& input,std::vector<Vector2<int> > output);
00305 
00306   /** Implemented with ColorTable interface.
00307   * @param v Input pixel.
00308   * @return The classified color of the pixel.
00309   */
00310   inline colorClass getColor(Vector2<int> v){
00311     return getColor(v.x,v.y); 
00312   };
00313   /** Implemented with ColorTable interface.
00314   * @param x X-coordinate of the requested pixel.
00315   * @param y Y-coordinate of the requested pixel.
00316   * @return The classified color of the pixel.
00317   */
00318   inline colorClass getColor(int x,int y){
00319     unsigned char cy = rip->image.image[y][0][x];
00320     unsigned char cu = rip->image.image[y][1][x];
00321     unsigned char cv = rip->image.image[y][2][x];
00322     ColorCorrector::correct(x,y,cy,cu,cv);
00323     return rip->colorTable.getColorClass(cy,cu,cv); 
00324   };
00325   /** Implemented with ColorTable interface.
00326   *   @param x X-coordinate of the requested pixel.
00327   *   @param y Y-coordinate of the requested pixel.
00328   *   @param color The color class to match.
00329   *   @return True if color equals getColor(x,y).
00330   */
00331   inline bool checkColor(int x,int y,colorClass color){
00332     return  color == getColor(x,y);
00333   };
00334   /** Implemented with ColorTable interface.
00335   *   @param v The requested pixel.
00336   *   @param color The color class to match.
00337   *   @return True if color equals getColor(x,y).
00338   */
00339   inline bool checkColor(Vector2<int> v,colorClass color){
00340     return  color == getColor(v.x,v.y);
00341   };
00342 
00343 
00344   /** Scans to the top, until the colorClass(x,y) changes or the border
00345   * of the image is reached.
00346   * @param x x-coordinate of the start
00347   * @param y y-coordinate of the start
00348   * @return Last pixel with the same colorClass of the given position 
00349   * represented as a Vector2<int>.
00350   */
00351   Vector2<int> scanNorth(int x,int y)
00352   { 
00353     Vector2<int> v(x,y);
00354     if (y<1) return v;
00355     search = getColor(v.x,v.y /*- rip->marginY*/);
00356 
00357     while (v.y > 0 && checkColor(v,search)) --v.y;
00358     ++v.y;
00359 
00360     return v;
00361   };
00362   /** Scans to the bottom, until getColor(x,y) changes or the border
00363   * of the image is reached.
00364   * @param x x-coordinate of the start
00365   * @param y y-coordinate of the start 
00366   * @return Last pixel with the same colorClass of the given position 
00367   * represented as a Vector2<int>.*/
00368   Vector2<int> scanSouth(int x,int y){
00369     Vector2<int> v(x,y);
00370 
00371     search = getColor(v.x,v.y /*- rip->marginY*/);
00372 
00373     while (v.y < (imageHeight - 1) && checkColor(v,search)) ++v.y;
00374     --v.y;
00375     return v;
00376   };
00377   /** Scans to the right side, until getColor(x,y) changes or the border
00378   * of the image is reached. 
00379   * @param x x-coordinate of the start
00380   * @param y y-coordinate of the start
00381   * @return Last pixel with the same colorClass of the given position 
00382   * represented as a Vector2<int>.*/
00383   Vector2<int> scanWest(int x,int y){
00384     Vector2<int> v(x,y);
00385     
00386     search = getColor(v.x /*- rip->marginX*/,v.y);
00387 
00388     while (v.x > 1 && checkColor(v,search))--v.x;
00389     ++v.x;
00390     return v;
00391   };
00392   /** Scans to the left side, until getColor(x,y) changes or the border
00393   * of the image is reached. 
00394   * @param x x-coordinate of the start
00395   * @param y y-coordinate of the start
00396   * @return Last pixel with the same colorClass of the given position 
00397   * represented as a Vector2<int>.*/
00398   Vector2<int> scanEast(int x,int y){
00399     Vector2<int> v(x,y);
00400     search = getColor(v.x /*+ rip->marginX*/,v.y);
00401     while (v.x < (imageWidth - 2) && checkColor(v,search))++v.x;
00402     --v.x;
00403     
00404     return v;
00405   };
00406   /** Scans to top left, until getColor(x,y) changes or the border
00407   * of the image is reached. 
00408   * @param x x-coordinate of the start
00409   * @param y y-coordinate of the start
00410   * @return Last pixel with the same colorClass of the given position 
00411   * represented as a Vector2<int>.*/
00412   Vector2<int> scanNW(int x,int y){
00413     Vector2<int> v(x,y);
00414     
00415     search = getColor(v.x,v.y);
00416 
00417     while (checkColor(v,search)){ 
00418       --v.x; 
00419       --v.y;
00420     }
00421     
00422     return v;
00423   };
00424   /** Scans to down left, until getColor(x,y) changes or the border
00425   * of the image is reached. 
00426   * @param x x-coordinate of the start
00427   * @param y y-coordinate of the start
00428   * @return Last pixel with the same colorClass of the given position 
00429   * represented as a Vector2<int>.*/
00430   Vector2<int> scanSW(int x,int y){
00431     Vector2<int> v(x,y);
00432     search = getColor(v.x,v.y);
00433 
00434 
00435     while (checkColor(v,search)){ 
00436       --v.x; 
00437       ++v.y;
00438     }
00439     
00440     return v;
00441   };
00442   /** Scans to down right, until getColor(x,y) changes or the border
00443   * of the image is reached. 
00444   * @param x x-coordinate of the start
00445   * @param y y-coordinate of the start
00446   * @return Last pixel with the same colorClass of the given position 
00447   * represented as a Vector2<int>.*/
00448   Vector2<int> scanSE(int x,int y){
00449     Vector2<int> v(x,y);
00450     search = getColor(v.x,v.y);
00451 
00452     while (checkColor(v,search)){ 
00453       ++v.x; 
00454       ++v.y;
00455     }
00456     
00457     return v; 
00458   };
00459   /** Scans to top right, until getColor(x,y) changes or the border
00460   * of the image is reached. 
00461   * @param x x-coordinate of the start
00462   * @param y y-coordinate of the start
00463   * @return Last pixel with the same colorClass of the given position 
00464   * represented as a Vector2<int>.*/
00465   Vector2<int> scanNE(int x,int y){
00466     Vector2<int> v(x,y);
00467     search = getColor(v.x,v.y);
00468 
00469     while (checkColor(v,search)){ 
00470       ++v.x; 
00471       --v.y;
00472     }
00473     
00474     return v;
00475   };
00476   /** Scans to the give direction, until getColor(x,y) changes or the border
00477   * of the image is reached.
00478   * @param v coordinates of the start
00479   * @param direction the scan-direction
00480   * @return Last pixel with the same colorClass of the given position 
00481   * represented as a Vector2<int>.*/
00482   Vector2<int> scan(Vector2<int> v,short direction){
00483 
00484 
00485     switch (direction){
00486     
00487     case 0:
00488       currentX = 0;
00489       currentY = -1;
00490     case 1:
00491       currentX = 0;
00492       currentY = +1;
00493       break;
00494     case 2:
00495       break;
00496       currentX = -1;
00497       currentY = 0;
00498     case 3:
00499       break;
00500       currentX = +1;
00501       currentY = 0;
00502     case 4:
00503       break;
00504       currentX = -1;
00505       currentY = -1;
00506     case 5:
00507       break;
00508       currentX = -1;
00509       currentY = +1;
00510     case 6:
00511       break;
00512       currentX = +1;
00513       currentY = +1;
00514     case 7:
00515       break;
00516       currentX = +1;
00517       currentY = -1;
00518     
00519     default:
00520       return errorDummy;  
00521     
00522     }
00523     search = getColor(v.x,v.y);
00524 
00525     while (checkColor(v,search)){  
00526       v.x =+ currentX; 
00527       v.y =+ currentY;
00528     }
00529     
00530     return v;
00531   }
00532   /** Scans in the given direction and stops if the given color is found
00533   * or the border of the image is reached.
00534   * @param v coordinates of the start
00535   * @param search colorClass to search for
00536   * @param direction the scan-direction
00537   * @return The first pixel where the expression 
00538   *     (search == getColor(x,y)) is true.
00539   */
00540   Vector2<int> scan(Vector2<int> v,short direction,colorClass search){
00541 
00542 
00543     switch (direction){
00544     
00545     case 0:
00546       currentX = 0;
00547       currentY = -1;
00548     case 1:
00549       currentX = 0;
00550       currentY = +1;
00551       break;
00552     case 2:
00553       break;
00554       currentX = -1;
00555       currentY = 0;
00556     case 3:
00557       break;
00558       currentX = +1;
00559       currentY = 0;
00560     case 4:
00561       break;
00562       currentX = -1;
00563       currentY = -1;
00564     case 5:
00565       break;
00566       currentX = -1;
00567       currentY = +1;
00568     case 6:
00569       break;
00570       currentX = +1;
00571       currentY = +1;
00572     case 7:
00573       break;
00574       currentX = +1;
00575       currentY = -1;
00576     
00577     default:
00578       return errorDummy;  
00579     
00580     }
00581     while (!checkColor(v,search)){   
00582       v.x =+ currentX; 
00583       v.y =+ currentY;
00584     }
00585     
00586     return v;
00587   }
00588   /** Scans in the given direction and stops if color changes.
00589   *   @param x x-coordinate of the start
00590   *   @param y y-coordinate of the start
00591   *   @param direction the scan-direction
00592   *   @return The last pixel with the same color as the start pixel.
00593   */
00594   inline Vector2<int> scan(int x,int y,short direction){
00595     Vector2<int> v(x,y);
00596     return scan(v,direction);
00597   }
00598   /** Calculates the distance to the line.
00599   *   @param line the line
00600   *   @param point the point
00601   *   @return the distance of the point to the line*/
00602   inline float getDistanceToLine(const Geometry::Line line,const Vector2<int>& point) {
00603 
00604     Vector2<double> pd((double)point.x,(double)point.y);
00605 
00606     if (line.direction.x == 0 && line.direction.y == 0) 
00607       return (float) Geometry::distance(pd, line.base);
00608 
00609     Vector2<double> normal;
00610     normal.x = line.direction.y;
00611     normal.y = -line.direction.x;
00612     normal.normalize();
00613 
00614     double c = normal * line.base;
00615 
00616     return float(normal * pd - c);
00617   }
00618   /** The theta function for the difference of two vectors.
00619   *   @param v1 First vector.
00620   *   @param v2 Second vector.
00621   *   @return A number between 0 and 360 with the same order as v.angle() .
00622   */
00623   inline double theta(Vector2<int>& v1, Vector2<int>& v2){
00624     double t = 0;
00625     int dx = v1.x - v2.x;
00626     int dy = v1.y - v2.y;
00627     int ax = abs(dx);
00628     int ay = abs(dy);
00629     if (dx == 0 && dy == 0) t = 0;
00630     else t = (double)dy /(double)(ax + ay);
00631     if (dx < 0) t = 2 - t;
00632     else if (dy < 0) t = 4 + t;
00633     return t*90; // multiplication with 90 is not needed for correct ordering
00634   }
00635   /** The theta function.
00636   *   @param v the input
00637   *   @return a number between 0 and 360 with the same order as v.angle() 
00638   */
00639   inline double theta(Vector2<int>& v){
00640     double t = 0;
00641     int ax = abs(v.x);
00642     int ay = abs(v.y);
00643     if (v.x == 0 && v.y == 0) t = 0;
00644     else t = (double)v.y /(double)(ax + ay);
00645     if (v.x < 0) t = 2 - t;
00646     else if (v.y < 0) t = 4 + t;
00647     return t*90; // multiplication with 90 is not needed for correct ordering
00648   }
00649   /** Helper.
00650   *   @param value the input
00651   *   @return sign of the given value.
00652   */
00653   inline int sign(int value){
00654     return value < 0 ? -1 : 1;
00655   }
00656   
00657 private:
00658   /** A temporary variable for the direction offset.*/
00659   int currentX;
00660   /** A temporary variable for the direction offset.*/
00661   int currentY;
00662   /** A temporary variable.*/
00663   colorClass search;
00664   /** Offset value for Y channel.*/
00665   int const Y_VALUE;
00666   /** Offset value for U channel.*/
00667   int const U_VALUE;
00668   /** Offset value for V channel.*/
00669   int const V_VALUE;
00670   /** List for segmentation functions.*/
00671   std::list<std::list<LinePair> > segList;
00672 
00673   /** Tests if two runs have a distance smaller than the allowed space.
00674   *
00675   *   @param inSegment First run.
00676   *   @param newPair Second run.
00677   *   @param allowedSpace The allowed space between the pairs. The value may also be negative.
00678   *   @return True, if the distance is smaller than allowedSpace.
00679   */
00680   inline bool linePairsFit(LinePair& inSegment ,LinePair& newPair,int allowedSpace){
00681       return (!((inSegment.v2.x+allowedSpace<newPair.v1.x)
00682       ||(inSegment.v1.x-allowedSpace>newPair.v2.x)));
00683   }
00684   /** Tests if two runs have a distance smaller than the allowed space.
00685   *
00686   *   @param inSegment First run.
00687   *   @param newPair Second run.
00688   *   @param allowedSpace The allowed space between the pairs. The value may also be negative.
00689   *   @return True, if the distance is smaller than allowedSpace.
00690   */
00691   inline bool gridFit(GridLP& inSegment ,GridLP& newPair,int allowedSpace){
00692         return (!((inSegment.d2+allowedSpace<newPair.d1)
00693       ||(inSegment.d1-allowedSpace>newPair.d2)));
00694   }
00695 
00696   /** Tests if two runs have a distance smaller than the allowed space and if
00697   *   their color is the same.
00698   *
00699   *   @param inSegment First run.
00700   *   @param newPair Second run.
00701   *   @param allowedSpace The allowed space between the pairs. The value may also be negative.
00702   *   @return True, if the distance is smaller than allowedSpace and the color is equal.
00703   */
00704   inline bool linesFit(LinePair& inSegment ,LinePair& newPair,int allowedSpace){
00705     return (!((inSegment.v2.x+allowedSpace<newPair.v1.x)
00706       ||(inSegment.v1.x-allowedSpace>newPair.v2.x))
00707       && newPair.color == inSegment.color);
00708   }
00709 
00710 };
00711 
00712 #endif
00713 
00714 
00715 /*
00716 * Change log :
00717 * 
00718 * $Log: RasterSpecialist.h,v $
00719 * Revision 1.6  2004/09/08 12:41:43  wachter
00720 * - Fixed some warnings
00721 * - Fixed some documentation in network-code
00722 *
00723 * Revision 1.5  2004/09/06 12:02:26  schmidtb
00724 * commented almost all members, removed warnings in documentation
00725 
00726 * did further code clean up
00727 *
00728 * Revision 1.4  2004/09/03 11:32:14  nistico
00729 * References to MSH2004ColorCorrector removed, now uses the unified ColorCorrector
00730 *
00731 * Revision 1.3  2004/09/02 07:59:29  schmidtb
00732 * Added RasterImageProcessor to repository, because we used it for the OpenChallenge.
00733 *
00734 * Revision 1.20  2004/05/27 11:18:48  schmidtb
00735 * new version with further work for open challenge
00736 *
00737 * Revision 1.19  2004/05/25 13:27:34  schmidtb
00738 * modified version of rip for open-challenge
00739 *
00740 * Revision 1.20  2004/04/22 16:57:26  pg_besc
00741 * new version of RBallSpecialist2, now omnidirectional scans for detection
00742 *
00743 * Revision 1.19  2004/04/20 07:50:27  pg_besc
00744 * new version of pre scan
00745 *
00746 * Revision 1.18  2004/03/17 17:06:09  koh
00747 * added enemyOnlySpecialist;
00748 * added enemySpecialist2;
00749 * added some int and bool variables
00750 *
00751 * Revision 1.17  2004/03/11 20:32:58  schmidtb
00752 * new version of rip
00753 *
00754 * Revision 1.16  2004/03/04 09:54:51  schmidtb
00755 * color correction integrated
00756 *
00757 * Revision 1.15  2004/03/03 12:53:21  schmidtb
00758 * color correction integrated
00759 *
00760 * Revision 1.14  2004/02/18 14:56:19  neubach
00761 * new Segmentation established, code not cleared at all
00762 *
00763 * Revision 1.13  2004/02/04 13:00:49  schmidtb
00764 * new version of BoxSpecialist
00765 *
00766 * Revision 1.12  2004/02/02 13:42:12  schmidtb
00767 * merged sources of RIP. added som functions.
00768 *
00769 * Revision 1.11  2004/01/31 11:45:02  hyung
00770 * modified enemyValidity-calculation;
00771 * established basical enviroment for TrikotErkennung, based on Arrays and Lists, changes will take affect only #ifdef TrikotErkennung!
00772 *
00773 * Revision 1.10  2004/01/26 22:21:09  schmidtb
00774 * bugfixed BoxSpecialist
00775 *
00776 * Revision 1.9  2004/01/26 20:37:56  schmidtb
00777 * removed errors and warnings, merged versions of RGoalSpecialist
00778 *
00779 * Revision 1.8  2004/01/19 16:18:45  schmidtb
00780 * GoalSpecialist recognizes Landmarks
00781 *
00782 * Revision 1.7  2004/01/15 13:45:02  schmidtb
00783 * segmentation established
00784 *
00785 * Revision 1.6  2003/12/15 13:55:32  schmidtb
00786 * Merged and patched new version of RasterImageProcessor.
00787 *
00788 * Revision 1.5  2003/12/08 15:02:55  schmidtb
00789 * new version of RIP
00790 *
00791 * Revision 1.4  2003/12/04 09:51:23  schmidtb
00792 * better BallSpecialist
00793 *
00794 * Revision 1.3  2003/12/02 21:59:02  schmidtb
00795 * New version of RasterImageProcessor
00796 *
00797 * Revision 1.2  2003/11/20 10:26:56  schmidtb
00798 * Ball Detection added
00799 *
00800 * Revision 1.1  2003/11/12 13:13:20  schmidtb
00801 * new RasterImageProcessor added
00802 *
00803 *
00804 */

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