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

Representations/Perception/Image.h

Go to the documentation of this file.
00001 /**
00002  * @file Image.h
00003  * 
00004  * Declaration of class Image
00005  */ 
00006 
00007 #ifndef __Image_h_
00008 #define __Image_h_
00009 
00010 #include "CameraInfo.h"
00011 
00012 // forward declaration
00013 class Image;
00014 
00015 #include "Tools/Streams/InOut.h"
00016 #include "Representations/Perception/ColorTable.h"
00017 #include "Tools/ColorClasses.h"
00018 #include "Tools/Math/Common.h"
00019 #include <string.h>
00020 
00021 /**
00022 * Platform independend definition of an image class
00023 */
00024 class Image
00025 {
00026 public:
00027   /** constructs an image */
00028   Image();
00029 
00030   /** deconstructs an image */
00031   ~Image();
00032 
00033   bool          hasColorTable(void);
00034   void          setColorTable(const ColorTable* ct);
00035   char          getClassifiedColor(int x, int y) const;
00036   char          getClassifiedColor(unsigned long index) const;
00037 
00038   /** Converts an YCbCr image into an RGB image.
00039    *  @param ycbcrImage The given YCbCr image
00040    */
00041   void convertFromYCbCrToRGB(const Image& ycbcrImage);
00042 
00043   /** Converts an RGB image into an YCbCr image.
00044    *  @param rgbImage The given RGB image
00045    */
00046   void convertFromRGBToYCbCr(const Image& rgbImage);
00047 
00048   /** Converts an YCbCr image into a HSI image.
00049    *  @param ycrcbImage The given YCbCr image
00050    */
00051   void convertFromYCbCrToHSI(const Image& ycrcbImage);
00052 
00053   /** Converts a HSI image into an YCbCr image.
00054    *  @param hsiImage The given HSI image
00055    */
00056   void convertFromHSIToYCbCr(const Image& hsiImage);
00057 
00058   /** Converts an YCbCr image into a TSL image.
00059    *  @param ycbcrImage The given YCbCr image
00060    */
00061   void convertFromYCbCrToTSL(const Image& ycbcrImage);
00062 
00063   /** Returns the high resolution y value of a pixel
00064    *  @param x The x coord. of the pixel in high resolution
00065    *  @param y The y coord. of the pixel in high resolution
00066    *  @return The y value of the pixel
00067    */
00068   unsigned char getHighResY(int x, int y) const;
00069 
00070   /** Sets the high resolution y values for one pixel in low resolution 
00071    * @param x The x coord. of the pixel
00072    * @param y The y coord. of the pixel
00073    * @param tl The y value of the top left subpixel
00074    * @param bl The y value of the bottom left subpixel
00075    * @param tr The y value of the top right subpixel
00076    * @param br The y value of the bottom right subpixel
00077    */
00078   void setHighResY(int x, int y, unsigned char tl, unsigned char bl, unsigned char tr, unsigned char br);
00079 
00080   /** Assignment operator
00081   *\param other The other Image that is assigned to this one
00082   *\return A reference to this object after the assignment.
00083   */
00084   Image& operator=(const Image& other) 
00085   {
00086     memcpy((void *)this, (const void *)&other, sizeof(Image));
00087     return *this;
00088   }
00089 
00090   /** representation for an image
00091   * height color width
00092   * point of origin is the upper left corner, height is positive downwards
00093   * and width positive to the right
00094   * the color values are in the order Y,U,V, 3xY in a higher resolution
00095   */
00096   unsigned char image[cameraResolutionHeight_ERS7][6][cameraResolutionWidth_ERS7];
00097 
00098   CameraInfo cameraInfo;
00099 
00100   /** the frame number of that image */
00101   unsigned long frameNumber;
00102 
00103   /** associated color table */
00104   const ColorTable* colorTable;
00105 
00106   /**
00107   * set values in CameraInfo according to image size
00108   */
00109   void setCameraInfo();
00110 };
00111 
00112 /**
00113  * Streaming operator that writes an Image to a stream.
00114  * @param stream The stream to write on.
00115  * @param image The Image object.
00116  * @return The stream.
00117  */ 
00118 Out& operator<<(Out& stream, const Image& image);
00119 
00120 /**
00121  * Streaming operator that reads a Image from a stream.
00122  * @param stream The stream to read from.
00123  * @param image The Image object.
00124  * @return The stream.
00125  */ 
00126 In& operator>>(In& stream,Image& image);
00127 
00128 #endif //__Image_h_

Generated on Mon Mar 20 22:00:03 2006 for GT2005 by doxygen 1.3.6