00001 #ifndef GT2005CLUSTERLISTE_H 00002 #define GT2005CLUSTERLISTE_H 00003 00004 #include "GT2005Clusterliste.h" 00005 #include <math.h> 00006 /*#include "Tools/MessageQueue/MessageIDs.h" 00007 #include "Tools/MessageQueue/OutMessage.h" 00008 #include "Tools/Debugging/Debugging.h"*/ 00009 00010 class GT2005Clustering 00011 { 00012 private: 00013 00014 //case of vertical-scanning: a value for the bounding box that defines, which neighbour-cluster in horizontal 00015 //direction are candidates. the value depends on the spacing between the scan-lines. since there are three vertical 00016 //scan-lines of different length, there will be three different values. 00017 int vhshort; 00018 int vhmiddle; 00019 int vhlong; 00020 00021 //defines the start y-coordinate of the differtent vertical scan-lines 00022 int yshort; //the begin of the scan line 00023 int ymiddle; //the transistion between short to middle 00024 int ylong; //the transition between middle to long 00025 00026 //case of horizontal-scanning: a value for the bounding box that defines, which neighbour-cluster in vertical 00027 //direction are candidates: 00028 int hv; 00029 00030 //distance between clusters in vertical scan: 00031 int vh; 00032 00033 //solution of image 00034 //length of the image 00035 int lImage; 00036 //height of the image 00037 int hImage; 00038 00039 00040 //object of clusterliste to manage the cluster 00041 GT2005Clusterliste cl; 00042 00043 //a scan-line is not exactly horizontal or vertical. so it can be described through a bounding box: 00044 double xmin,xmax,ymin,ymax; 00045 00046 //flag that indicates the direction of the scan-line: vertical or horizontal. itīs needed, because 00047 //it shows, which data-structure is in use right now (vNavi vor vertical scan-lines and hNavi for horizontal scan-lines) 00048 bool vertical; 00049 00050 //the distance between scan-line and cluster or between two clusters 00051 double distance; 00052 00053 //iterator that marks the range of candidates to cluster 00054 std::list<std::list<GT2005Cluster>::iterator>::iterator cfirst; //first candidate 00055 std::list<std::list<GT2005Cluster>::iterator>::iterator clast; //last candidate 00056 std::list<std::list<GT2005Cluster>::iterator>::iterator cinput;//position of the new cluster; 00057 00058 //iterator for the clusterlist 00059 std::list<GT2005Cluster>::iterator cIter; 00060 std::list<GT2005Cluster>::iterator cIter2; 00061 00062 //iterator for the iteratorlist 00063 std::list<std::list<GT2005Cluster>::iterator>::iterator vhIter; 00064 std::list<std::list<GT2005Cluster>::iterator>::iterator vhIter2; 00065 00066 00067 //mark candidate for horizontal direction 00068 void markV(double xminimum, double xmaximum, double yminimum, double ymaximum, int expansion); 00069 00070 00071 void Cluster1(bool v); 00072 00073 //mark candidate for horizontal direction 00074 void markH(double xminimum, double xmaximum, double yminimum, double ymaximum, int expansion); 00075 00076 //prepare for vertical scanning: choose nNavi, set the iterators and skip not interessting clusters 00077 //original means: use the bounding box of the scan-line: xmin,xmax,ymin,ymax 00078 //otherwise use the modified bounding box, xn,xx,yn,yx 00079 void prepV(double xminimum); 00080 00081 //prepare for horizontal scanning: choose hNavi, set the iterators and skip not interessting clusters 00082 //original means: use the bounding box of the scan-line: xmin,xmax,ymin,ymax 00083 //otherwise use the modified bounding box, xn,xx,yn,yx 00084 void prepH(double yminimum); 00085 00086 //first Case: nach markV und markH 00087 void clusterFinal(bool vertical, double xminimum,double xmaximum,double yminimum, double ymaximum); 00088 00089 //midointslist 00090 std::list<Vector2<double> > hlist; 00091 00092 //iterator for midpointlist 00093 std::list<Vector2<double> >::iterator hiterator; 00094 00095 00096 00097 public: 00098 GT2005Clustering(); 00099 00100 //a method to add a new scan-line. if the scan-line is positioned next to existing clusters, the scan-line and these 00101 //clusters will be merged to one cluster. 00102 //start is the start-point of the scan-line and end the end-point. length is the length of the run measured in pixel. 00103 void addLine(Vector2<int> start, Vector2<int> end, int length); 00104 00105 Vector2<double> getMidpoint(int elementnr); 00106 00107 Vector2<double> getMidpointX(int elementnr); 00108 00109 Vector2<double> getMidpointY(int elementnr); 00110 00111 int getSize(); 00112 00113 void reset(); 00114 00115 GT2005Cluster getClusterX(int elementnr); 00116 00117 GT2005Cluster getClusterY(int elementnr); 00118 00119 }; 00120 00121 00122 #endif 00123 00124
1.3.6