00001 /** 00002 * @file VLCColorSpace.h 00003 * 00004 * This file contains a class for Image Processing. 00005 * 00006 * @author Tobias Wegner 00007 */ 00008 00009 #ifndef __VLCColorSpace_h_ 00010 #define __VLCColorSpace_h_ 00011 00012 #include "Tools/Math/Common.h" 00013 #include "Tools/ColorClasses.h" 00014 00015 #define BRIGHTNESS_LEVELS 16 00016 #define DIRECTION_LEVELS 8 00017 00018 class ColorSpace 00019 { 00020 public: 00021 ColorSpace (); 00022 00023 void Normalize (); 00024 double Sum (); 00025 00026 void AddSample (colorClass color, double brightness, double dY); 00027 00028 colorClass getMajorColor (); 00029 00030 ColorSpace& operator+=(const ColorSpace& other) 00031 { 00032 int i; 00033 for (i = 0; i < numOfColors; i++) 00034 colorCount[i] += other.colorCount[i]; 00035 00036 for (i = 0; i < BRIGHTNESS_LEVELS; i++) 00037 yCount[i] += other.yCount[i]; 00038 00039 y += other.y; 00040 dY += other.dY; 00041 00042 return *this; 00043 } 00044 00045 00046 double colorCount[numOfColors]; 00047 double yCount[BRIGHTNESS_LEVELS]; 00048 double y; 00049 double dY; 00050 }; 00051 00052 class RobotDirection 00053 { 00054 public: 00055 RobotDirection (); 00056 00057 void AddSample (double direction) { AddSample (direction, 1); }; 00058 void AddSample (double direction, int weight); 00059 00060 double getDirection (); 00061 double getReliability (); 00062 00063 double directionCount[DIRECTION_LEVELS]; 00064 }; 00065 #endif
1.3.6