00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __DebugImages_h_
00009 #define __DebugImages_h_
00010
00011 #include "Tools/Debugging/Debugging.h"
00012
00013 #ifdef NDEBUG
00014 #define NODEBUGDRAWINGS
00015 #endif
00016 #ifdef NO_DEBUG_DRAWING
00017 #define NODEBUGDRAWINGS
00018 #endif
00019
00020 #ifdef NODEBUGDRAWINGS
00021 #define DECLARE_DEBUG_COLOR_CLASS_IMAGE(id)
00022 #define SEND_DEBUG_COLOR_CLASS_IMAGE(id)
00023 #else //NODEBUGDRAWINGS
00024
00025
00026
00027
00028 #define DECLARE_DEBUG_COLOR_CLASS_IMAGE(id) ColorClassImage id##ColorClassImage
00029
00030
00031 #define SEND_DEBUG_COLOR_CLASS_IMAGE(id) INFO(send_##id##_image, idDebugColorClassImage, bin, Images::id << id##ColorClassImage)
00032
00033 #endif //NODEBUGDRAWINGS
00034
00035
00036 #if defined(_WIN32)
00037
00038
00039
00040
00041
00042 #define DECLARE_DEBUG_IMAGE(id) Image id##Image
00043
00044
00045
00046
00047
00048
00049 #define INIT_DEBUG_IMAGE(id, image) id##Image = image
00050
00051
00052
00053
00054
00055 #define GENERATE_DEBUG_IMAGE(id,expression) \
00056 if (getDebugKeyTable().isActive(DebugKeyTable::send_##id##_image)) {\
00057 expression;\
00058 }
00059
00060
00061 #define SEND_DEBUG_IMAGE(id) INFO(send_##id##_image, idDebugImage, bin, Images::id << id##Image)
00062
00063
00064 #define DEBUG_IMAGE_SET_PIXEL_Y(id, xx, yy, y) \
00065 { \
00066 if(xx >= 0 && xx < id##Image.cameraInfo.resolutionWidth && \
00067 yy >= 0 && yy < id##Image.cameraInfo.resolutionHeight) \
00068 id##Image.image[yy][0][xx] = y; \
00069 }
00070
00071
00072 #define DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, y, u, v) \
00073 { \
00074 if(xx >= 0 && xx < id##Image.cameraInfo.resolutionWidth && \
00075 yy >= 0 && yy < id##Image.cameraInfo.resolutionHeight) \
00076 { \
00077 id##Image.image[yy][0][xx] = y; \
00078 id##Image.image[yy][1][xx] = u; \
00079 id##Image.image[yy][2][xx] = v; \
00080 } \
00081 }
00082
00083 #define DEBUG_IMAGE_GET_PIXEL_Y(id, xx, yy) id##Image.image[yy][0][xx]
00084 #define DEBUG_IMAGE_GET_PIXEL_U(id, xx, yy) id##Image.image[yy][1][xx]
00085 #define DEBUG_IMAGE_GET_PIXEL_V(id, xx, yy) id##Image.image[yy][2][xx]
00086
00087
00088 #define DEBUG_IMAGE_SET_PIXEL_BLACK(id, xx, yy)\
00089 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 0, 127, 127)
00090
00091 #define DEBUG_IMAGE_SET_PIXEL_WHITE(id, xx, yy)\
00092 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 255, 127, 127)
00093
00094 #define DEBUG_IMAGE_SET_PIXEL_GREEN(id, xx, yy)\
00095 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 180, 0, 0)
00096
00097 #define DEBUG_IMAGE_SET_PIXEL_LIGHT_GRAY(id, xx, yy)\
00098 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 192, 127, 127)
00099
00100 #define DEBUG_IMAGE_SET_PIXEL_GRAY(id, xx, yy)\
00101 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 127, 127, 127)
00102
00103 #define DEBUG_IMAGE_SET_PIXEL_DARK_GRAY(id, xx, yy)\
00104 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 64, 127, 127)
00105
00106 #define DEBUG_IMAGE_SET_PIXEL_DARK_GREEN(id, xx, yy)\
00107 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 0, 0, 0)
00108
00109 #define DEBUG_IMAGE_SET_PIXEL_ORANGE(id, xx, yy)\
00110 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 100, 255, 0)
00111
00112 #define DEBUG_IMAGE_SET_PIXEL_YELLOW(id, xx, yy)\
00113 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 180, 255, 0)
00114
00115 #define DEBUG_IMAGE_SET_PIXEL_RED(id, xx, yy)\
00116 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 0, 255, 0)
00117
00118 #define DEBUG_IMAGE_SET_PIXEL_MAUVE(id, xx, yy)\
00119 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 0, 180, 255)
00120
00121 #define DEBUG_IMAGE_SET_PIXEL_BLUE(id, xx, yy)\
00122 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 180, 0, 255)
00123
00124 #define DEBUG_IMAGE_SET_PIXEL_PINK(id, xx, yy)\
00125 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 255, 255, 255)
00126
00127 #define DEBUG_IMAGE_SET_PIXEL_DARK_BLUE(id, xx, yy)\
00128 DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, 100, 0, 255)
00129
00130 #else //_WIN32
00131
00132 #ifdef __GNUC__
00133 #define DECLARE_DEBUG_IMAGE(id)
00134 #else
00135 #define DECLARE_DEBUG_IMAGE(id) static bool id##Dummy
00136 #endif
00137 #define INIT_DEBUG_IMAGE(id, image)
00138 #define GENERATE_DEBUG_IMAGE(id,expression)
00139 #define SEND_DEBUG_IMAGE(id)
00140 #define DEBUG_IMAGE_SET_PIXEL_Y(id, xx, yy, y)
00141 #define DEBUG_IMAGE_SET_PIXEL_YUV(id, xx, yy, y, u, v)
00142 #define DEBUG_IMAGE_SET_PIXEL_BLACK(id, xx, yy)
00143 #define DEBUG_IMAGE_SET_PIXEL_WHITE(id, xx, yy)
00144 #define DEBUG_IMAGE_SET_PIXEL_GREEN(id, xx, yy)
00145 #define DEBUG_IMAGE_SET_PIXEL_GRAY(id, xx, yy)
00146 #define DEBUG_IMAGE_SET_PIXEL_LIGHT_GRAY(id, xx, yy)
00147 #define DEBUG_IMAGE_SET_PIXEL_DARK_GRAY(id, xx, yy)
00148 #define DEBUG_IMAGE_SET_PIXEL_DARK_GREEN(id, xx, yy)
00149 #define DEBUG_IMAGE_SET_PIXEL_ORANGE(id, xx, yy)
00150 #define DEBUG_IMAGE_SET_PIXEL_YELLOW(id, xx, yy)
00151 #define DEBUG_IMAGE_SET_PIXEL_RED(id, xx, yy)
00152 #define DEBUG_IMAGE_SET_PIXEL_MAUVE(id, xx, yy)
00153 #define DEBUG_IMAGE_SET_PIXEL_BLUE(id, xx, yy)
00154 #define DEBUG_IMAGE_SET_PIXEL_PINK(id, xx, yy)
00155 #define DEBUG_IMAGE_SET_PIXEL_DARK_BLUE(id, xx, yy)
00156 #define DEBUG_IMAGE_GET_PIXEL_Y(id, xx, yy) 0
00157 #define DEBUG_IMAGE_GET_PIXEL_U(id, xx, yy) 0
00158 #define DEBUG_IMAGE_GET_PIXEL_V(id, xx, yy) 0
00159
00160 #endif //_WIN32
00161
00162
00163
00164
00165
00166 class Images
00167 {
00168 public:
00169
00170
00171
00172
00173 enum ImageID
00174 {
00175 noImage,
00176 rawImage,
00177 segmentedImage1,
00178 segmentedImage2,
00179 segmentedImage3,
00180 classificationY,
00181 classificationU,
00182 classificationV,
00183 colorFrequency,
00184 imageProcessorGeneral,
00185 imageProcessorScanLines,
00186 imageProcessorBall,
00187 imageProcessorGoals,
00188 imageProcessorFlags,
00189 imageProcessorPlayers,
00190 imageProcessorGradients,
00191 imageMotionRecognition,
00192 numberOfImageIDs,
00193 image = numberOfImageIDs,
00194 segmentedImage,
00195 correctedImage,
00196 correctedSegmentedImage
00197 };
00198
00199
00200
00201
00202
00203 static char* getImageIDName(ImageID imageID)
00204 {
00205 switch (imageID)
00206 {
00207 case noImage: return "no image";
00208 case rawImage: return "raw image";
00209 case segmentedImage1: return "segmented image 1";
00210 case segmentedImage2: return "segmented image 2";
00211 case segmentedImage3: return "segmented image 3";
00212 case classificationY: return "classificationY";
00213 case classificationU: return "classificationU";
00214 case classificationV: return "classificationV";
00215 case colorFrequency: return "colorFrequency";
00216 case imageProcessorGeneral: return "imageProcessorGeneral";
00217 case imageProcessorScanLines: return "imageProcessorScanLines";
00218 case imageProcessorBall: return "imageProcessorBall";
00219 case imageProcessorFlags: return "imageProcessorFlags";
00220 case imageProcessorGoals: return "imageProcessorGoals";
00221 case imageProcessorPlayers: return "imageProcessorPlayers";
00222 case imageProcessorGradients: return "imageProcessorGradients";
00223 case imageMotionRecognition: return "imageMotionRecognition";
00224 default: return "check available drawings";
00225 }
00226 }
00227
00228 static bool getDebugKeyID(enum ImageID imageID, DebugKeyTable::debugKeyID& debugKeyID)
00229 {
00230 switch (imageID)
00231 {
00232 case segmentedImage1: debugKeyID = DebugKeyTable::send_segmentedImage1_image; return true;
00233 case segmentedImage2: debugKeyID = DebugKeyTable::send_segmentedImage2_image; return true;
00234 case segmentedImage3: debugKeyID = DebugKeyTable::send_segmentedImage3_image; return true;
00235 case classificationY: debugKeyID = DebugKeyTable::send_classificationY_image; return true;
00236 case classificationU: debugKeyID = DebugKeyTable::send_classificationU_image; return true;
00237 case classificationV: debugKeyID = DebugKeyTable::send_classificationV_image; return true;
00238 case colorFrequency: debugKeyID = DebugKeyTable::send_colorFrequency_image; return true;
00239 case imageProcessorGeneral: debugKeyID = DebugKeyTable::send_imageProcessorGeneral_image; return true;
00240 case imageProcessorScanLines: debugKeyID = DebugKeyTable::send_imageProcessorScanLines_image; return true;
00241 case imageProcessorBall: debugKeyID = DebugKeyTable::send_imageProcessorBall_image; return true;
00242 case imageProcessorFlags: debugKeyID = DebugKeyTable::send_imageProcessorFlags_image; return true;
00243 case imageProcessorGoals: debugKeyID = DebugKeyTable::send_imageProcessorGoals_image; return true;
00244 case imageProcessorPlayers: debugKeyID = DebugKeyTable::send_imageProcessorPlayers_image; return true;
00245 case imageProcessorGradients: debugKeyID = DebugKeyTable::send_imageProcessorGradients_image; return true;
00246 case imageMotionRecognition: debugKeyID = DebugKeyTable::send_imageMotionRecognition_image; return true;
00247
00248 default: return false;
00249 }
00250 }
00251 };
00252
00253 #endif //__DebugImages_h_
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359