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

# Representations/Perception/ColorTable.h

Go to the documentation of this file.

    00001 /**
    00002 * @file ColorTable.h
    00003 * Declaration of class ColorTable.
    00004 *
    00005 * @author <A href=mailto:robocup@andreosterhues.de>André Osterhues</A>
    00006 */
    00007
    00008 #ifndef _ColorTable_h_
    00009 #define _ColorTable_h_
    00010
    00011 // forward declaration
    00012 class ColorTable;
    00013 class ColorClassImage;
    00014
    00015 #include "Image.h"
    00016 #include "ColorClassImage.h"
    00017
    00018 /**
    00019 * @class ColorTable
    00020 *
    00021 * Base class of ColorTable64 and ColorTableTSL.
    00022 */
    00023 class ColorTable
    00024 {
    00025 public:
    00026   /** Constructor */
    00027     ColorTable() {}
    00028
    00029   /** Destructor */
    00030   ~ColorTable() {}
    00031
    00032   /**
    00033   * Calculates the color class of a pixel.
    00034   * @param y the y value of the pixel
    00035   * @param u the u value of the pixel
    00036   * @param v the v value of the pixel
    00037   * @return the color class
    00038   */
    00039   virtual colorClass getColorClass(
    00040     const unsigned char y,
    00041     const unsigned char u,
    00042     const unsigned char v) const {return noColor;}
    00043
    00044   /**
    00045   * Segments an image to an color class image.
    00046   *
    00047   * This doesn't need to used in the image processor, but is needed for visualisation
    00048   * of color tables.
    00049   * @param image A reference to the image to be segmented
    00050   * @param colorClassImage A reference to the color class image to be created
    00051   * @return A reference to the created color class image.
    00052   */
    00053   virtual void generateColorClassImage(
    00054     const Image& image,
    00055     ColorClassImage& colorClassImage) const
    00056     {}
    00057
    00058   /**
    00059   * Segments an image to an color class image using the high resolution y values.
    00060   *
    00061   * This doesn't need to used in the image processor, but is needed for visualisation
    00062   * of color tables.
    00063   * @param image A reference to the image to be segmented
    00064   * @param colorClassImage A reference to the color class image to be created
    00065   * @return A reference to the created color class image.
    00066   */
    00067   virtual void generateHighResColorClassImage(
    00068     const Image& image,
    00069     ColorClassImage& colorClassImage) const
    00070     {}
    00071
    00072   /** Sets the color class of every 4x4x4 to noColor */
    00073     virtual void clear() {}
    00074
    00075   /** Sets all cubes that have the given color class to noColor */
    00076     virtual void clearChannel(colorClass colorClass) {}
    00077
    00078   /**
    00079   * Sets the color class for a cube with the size "range" around a pixel
    00080   * given by y,u,v to the given color class.
    00081   */
    00082   virtual void addColorClass(
    00083     colorClass colorClass,
    00084     unsigned char y,
    00085     unsigned char u,
    00086     unsigned char v,
    00087     unsigned char range
    00088     ) {}
    00089   /**
    00090   * This function marks the outer pixels of all segmented colors in the colorspace as noColor.
    00091   */
    00092   virtual void shrink(){}
    00093
    00094   /**
    00095   * This function marks the outer pixels of the parameter color in the colorspace as noColor.
    00096   * &param color The color to shrink
    00097   */
    00098   virtual void shrink(unsigned char color){}
    00099
    00100   /**
    00101   * This function marks all noColor pixels in the colorspace, which are neighbors of segmented
    00102   * pixels, with the neighboring color.
    00103   */
    00104   virtual void grow(){}
    00105
    00106   /**
    00107   * This function marks all noColor pixels in the colorspace, which are neighbors of the parameter color,
    00108   * with the neighboring color.
    00109   */
    00110   virtual void grow(unsigned char color){}
    00111 };
    00112
    00113 #endif   //  _ColorTable_h_