00001 /** 00002 * @file RDefaultStrategy.h 00003 * 00004 * This file contains the definition of class RasterDefaultStrategy. 00005 * @author Damien Deom 00006 * @author Hyung Won Koh 00007 * @author Manuel Neubach 00008 * @author <a href="mailto:sadprofessor@web.de">Bernd Schmidt</a> 00009 */ 00010 #ifndef RDEFAULTSTRATEGY_H 00011 #define RDEFAULTSTRATEGY_H 00012 00013 class RDefaultStrategy; 00014 00015 #include "RasterStrategy.h" 00016 #include "REnemySpecialist.h" 00017 #include "RBallSpecialist2.h" 00018 #include "RFieldSpecialist.h" 00019 #include "BoxSpecialist.h" 00020 #include "RFieldStateMachine.h" 00021 #include "RBridgeSpecialist.h" 00022 #include "Modules/ImageProcessor/RasterImageProcessor/REdgeDetection.h" 00023 #include <vector> 00024 #include <deque> 00025 00026 #include "Tools/Math/Geometry.h" 00027 /** @class RDefaultStrategy 00028 * Default-implementation of RasterStrategy. 00029 * @author Damien Deom 00030 * @author Hyung Won Koh 00031 * @author Manuel Neubach 00032 * @author <a href="mailto:sadprofessor@web.de">Bernd Schmidt</a>*/ 00033 class RDefaultStrategy : public RasterStrategy 00034 { 00035 public: 00036 /** The Constructor. 00037 * For creation the RasterImageProcessor is needed. 00038 * @param processor The image-processor. 00039 */ 00040 RDefaultStrategy(RasterImageProcessor &processor); 00041 /** Destructor */ 00042 virtual ~RDefaultStrategy(); 00043 00044 /** Executes the strategy */ 00045 void execute(); 00046 /** Initializes the strategy and its specialists.*/ 00047 void init(); 00048 00049 private: 00050 00051 /** Executes the pre-scan.*/ 00052 void preScan(); 00053 /** Executes the post-scan.*/ 00054 void postScan(); 00055 /** Executes the post-processing.*/ 00056 void postProcessing(); 00057 /** Helper method for the scans. 00058 * @param x x-coordinate 00059 * @param y y-coordinate 00060 * @param prePost pre or post scan 00061 */ 00062 void checkBall(int x,int y,int prePost); 00063 /** Helper method for the scans. 00064 * @param x x-coordinate 00065 * @param y y-coordinate 00066 * @param prePost pre or post scan 00067 */ 00068 void checkField(int x,int y,int prePost); 00069 /** Helper method for the scans. 00070 * @param x x-coordinate 00071 * @param y y-coordinate 00072 * @param prePost pre or post scan 00073 */ 00074 void checkPlayer(int x,int y,int prePost); 00075 /** Helper method for the scans. 00076 * @param x x-coordinate 00077 * @param y y-coordinate 00078 * @param prePost pre or post scan 00079 */ 00080 void checkBox(int x, int y,int prePost); 00081 /** Helper method for the scans. 00082 * @param x x-coordinate 00083 * @param y y-coordinate 00084 */ 00085 void checkBridge(int x, int y); 00086 /** Helper method for the scans. 00087 * @param x x-coordinate 00088 * @param y y-coordinate 00089 */ 00090 void checkRedLine(int x,int y); 00091 00092 /** A pointer to the ball specialist.*/ 00093 RBallSpecialist2* ballSpecialist; 00094 /** A pointer to the field specialist (for Open Challenge 04).*/ 00095 RFieldSpecialist* fieldSpecialist; 00096 /** A pointer to the player specialist.*/ 00097 REnemySpecialist* enemySpecialist; 00098 /** A pointer to the box specialist (detects landmarks and goals).*/ 00099 BoxSpecialist* boxSpecialist; 00100 /** A pointer to the bridge specialist (for Open Challenge 04).*/ 00101 RBridgeSpecialist* bridgeSpecialist; 00102 /** The edge detector.*/ 00103 REdgeDetection edgeScanner; 00104 /** The point state machine.*/ 00105 RFieldStateMachine fieldDSA; 00106 /** The color of the previous pixel.*/ 00107 colorClass lastColor; 00108 /** The current color.*/ 00109 colorClass currentColor; 00110 /** Width of the image.*/ 00111 int width; 00112 /** Height of the image.*/ 00113 int height; 00114 /** The subsampling factor for the ball.*/ 00115 int ballFactor; 00116 /** The subsampling factor for the field.*/ 00117 int fieldFactor; 00118 /** The subsampling factor for the goals.*/ 00119 int goalFactor; 00120 /** The subsampling factor for the players.*/ 00121 int playerFactor; 00122 /** The subsampling factor for the landmarks.*/ 00123 int lmFactor; 00124 /** A temporary variable.*/ 00125 colorClass BoxColor; 00126 /** A temporary variable.*/ 00127 colorClass bridgeColor; 00128 /** Activation array for the several specialists.*/ 00129 bool active[7]; 00130 /** Threshold for the edge detection of the post scan.*/ 00131 int postThreshold; 00132 }; 00133 00134 #endif 00135 00136 /* 00137 * Change log : 00138 * 00139 * $Log: RDefaultStrategy.h,v $ 00140 * Revision 1.6 2004/09/09 11:08:04 spranger 00141 * renamed GT2004EdgeDetection to REdgeDetection for consistency 00142 * 00143 * Revision 1.5 2004/09/09 10:15:55 spranger 00144 * fixed doxygen-errors 00145 * 00146 * Revision 1.4 2004/09/06 12:02:26 schmidtb 00147 * commented almost all members, removed warnings in documentation 00148 00149 * did further code clean up 00150 * 00151 * Revision 1.3 2004/09/02 07:59:29 schmidtb 00152 * Added RasterImageProcessor to repository, because we used it for the OpenChallenge. 00153 * 00154 * Revision 1.31 2004/05/25 13:27:33 schmidtb 00155 * modified version of rip for open-challenge 00156 * 00157 * Revision 1.30 2004/05/24 14:45:04 deom 00158 * commented out bridgeSpecialist 00159 * 00160 * Revision 1.29 2004/05/22 19:03:40 deom 00161 * -now recognizes the red line 00162 * -all the data required for the positionning are computed 00163 * 00164 * Revision 1.31 2004/05/22 16:01:50 pg_besc 00165 * -modified version of rip for bridge-recognition 00166 * 00167 * Revision 1.30 2004/04/20 07:50:27 pg_besc 00168 * new version of pre scan 00169 * 00170 * Revision 1.29 2004/04/15 19:09:17 pg_besc 00171 * merged code 00172 * 00173 * Revision 1.28 2004/03/17 22:31:34 schmidtb 00174 * integrated RFieldStateMachine and horizonal grid scan 00175 * 00176 * Revision 1.27 2004/03/17 17:05:18 koh 00177 * added enemyOnlySpecialist to strategy; 00178 * added enemySpecialist2 to strategy; 00179 * 00180 * Revision 1.26 2004/03/11 20:49:39 schmidtb 00181 * new version of rip , merged code 00182 * 00183 * Revision 1.25 2004/03/03 12:53:21 schmidtb 00184 * color correction integrated 00185 * 00186 * Revision 1.24 2004/03/01 14:17:25 koh 00187 * added new strategy "RFlexibleStrategy" + new specialist "EnemyOnlySpecialist"; 00188 * changed references to "RDefaultStrategy" to references to "RasterStrategy" in RFieldSpecialist 00189 * added Geometry::Line horizon to "RasterStrategy" 00190 * 00191 * Revision 1.23 2004/02/18 14:56:19 neubach 00192 * new Segmentation established, code not cleared at all 00193 * 00194 * Revision 1.21 2004/02/04 15:05:20 schmidtb 00195 * warnings removed 00196 * 00197 * Revision 1.20 2004/02/04 13:00:49 schmidtb 00198 * new version of BoxSpecialist 00199 * 00200 * Revision 1.19 2004/02/03 23:09:18 hyung 00201 * Array based on rasterWidth now 00202 * 00203 * ! somehow it seems that my code produces warnings for which I'm 00204 * very very sorry, but my compiler told me always 0 errors, 0 warnings.... 00205 * does somebody know the reason? 00206 * 00207 * Revision 1.18 2004/02/03 21:18:27 hyung 00208 * some minor changes, 00209 * 00210 * size of Segmentborder-Array (TrikotErkennung) basically adaptive to rip-resolution 00211 * 00212 * Revision 1.17 2004/02/02 13:42:12 schmidtb 00213 * merged sources of RIP. added som functions. 00214 * 00215 * Revision 1.16 2004/01/31 11:45:02 hyung 00216 * modified enemyValidity-calculation; 00217 * established basical enviroment for TrikotErkennung, based on Arrays and Lists, changes will take affect only #ifdef TrikotErkennung! 00218 * 00219 * Revision 1.15 2004/01/23 15:44:01 deom 00220 * New specialist :: BoxSpecialist 00221 * Recognizes both landmarks and goals 00222 * 00223 * Revision 1.14 2004/01/23 10:13:17 neubach 00224 * - ball should no longer be misinterpreted as enemy 00225 * 00226 * Revision 1.13 2004/01/21 03:25:36 hyung 00227 * TrikotErkennung update 00228 * 00229 * Revision 1.12 2004/01/19 12:47:42 hyung 00230 * #ifDef TrikotErkennung mit alternativem Einstiegspunkt für Gegnererkennung 00231 * 00232 * Revision 1.11 2004/01/16 17:24:57 deom 00233 * no message 00234 * 00235 * Revision 1.10 2003/12/18 17:44:46 hyung 00236 * established new version of method checkGoal(int x,int y) 00237 * 00238 * Revision 1.9 2003/12/15 13:55:32 schmidtb 00239 * Merged and patched new version of RasterImageProcessor. 00240 * 00241 * Revision 1.8 2003/12/09 13:55:16 schumann 00242 * added missing include causing unresolved externals 00243 * 00244 * Revision 1.7 2003/12/08 15:02:55 schmidtb 00245 * new version of RIP 00246 * 00247 * Revision 1.6 2003/12/04 09:51:23 schmidtb 00248 * better BallSpecialist 00249 * 00250 * Revision 1.5 2003/12/02 21:59:02 schmidtb 00251 * New version of RasterImageProcessor 00252 * 00253 * Revision 1.4 2003/11/28 14:50:01 dueffert 00254 * bugs and warnings fixed 00255 * 00256 * Revision 1.3 2003/11/20 10:26:56 schmidtb 00257 * Ball Detection added 00258 * 00259 * Revision 1.2 2003/11/13 10:41:29 schmidtb 00260 * renewed RBallSpeciaslist and Strategy 00261 * 00262 * Revision 1.1 2003/11/12 13:13:20 schmidtb 00263 * new RasterImageProcessor added 00264 * 00265 * 00266 */