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

Modules/ImageProcessor/ImageProcessorTools/ColorSpaceUsageCounter.h

Go to the documentation of this file.
00001 /** 
00002 * @file ColorSpaceUsageCounter.h
00003 * Declaration of class ColorSpaceUsageCounter.
00004 *
00005 * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Jüngel</A>
00006 */
00007 
00008 #ifndef _ColorSpaceUsageCounter_h_
00009 #define _ColorSpaceUsageCounter_h_
00010 
00011 #include "Representations/Perception/Image.h"
00012 
00013 /**
00014 * @class ColorSpaceUsageCounter
00015 *
00016 * Contains a ColorSpaceUsageCounter which can count the frequency for
00017 * every 16 * 16 * 16 cube in the 255 * 255 * 255 YUV color space.
00018 *
00019 * @author <A href=mailto:juengel@informatik.hu-berlin.de>Matthias Jüngel</A>
00020 */
00021 
00022 class ColorSpaceUsageCounter
00023 {
00024 public:
00025   /** Constructor */
00026   ColorSpaceUsageCounter();
00027 
00028   /** Destructor */
00029   ~ColorSpaceUsageCounter();
00030 
00031   /** 
00032   * Returns the count for the cube associated to the y,u,v values.
00033   * @param y the y value of the pixel
00034   * @param u the u value of the pixel
00035   * @param v the v value of the pixel
00036   * @return the color class
00037   */
00038   int getCount (const unsigned char y, 
00039     const unsigned char u, 
00040     const unsigned char v) const
00041   {
00042     return count[y/16][u/16][v/16];
00043   }
00044 
00045   /**
00046   * Generates an image that visualizes the current ColorSpaceUsageCounter
00047   *
00048   * @param image A reference to the original image.
00049   * @param resultImage A reference to the resulting image.
00050   */
00051   virtual void generateImage(const Image& image, Image& resultImage) const;
00052 
00053   /** 
00054   * Each element in the array contains the count for a 16x16x16 cube in the color space.
00055   */
00056   unsigned short int count[16][16][16];
00057 
00058   /** Sets the count of every 16x16x16 cube to 0 */
00059   void reset();
00060   
00061   /** 
00062   */
00063   void addColor(unsigned char y, unsigned char u, unsigned char v);
00064 
00065   void addColor(unsigned char y, unsigned char u, unsigned char v, unsigned char range);
00066 
00067   bool isColorFrequent(unsigned char y, unsigned char u, unsigned char v, int threshold);
00068 
00069   int maxCount;
00070 };
00071 
00072 #endif   //  _ColorSpaceUsageCounter_h_

Generated on Mon Mar 20 21:59:49 2006 for GT2005 by doxygen 1.3.6