Fawkes API  Fawkes Development Version
qualifiers.h
00001 /***************************************************************************
00002  *  qualifiers.h - Pixel qualifier
00003  *
00004  *  Created: Mon, 09. Jun 2008 22:54
00005  *  Copyright  2008  Christof Rath <c.rath@student.tugraz.at>
00006  *
00007  ****************************************************************************/
00008 
00009 /*  This program is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License as published by
00011  *  the Free Software Foundation; either version 2 of the License, or
00012  *  (at your option) any later version.
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU Library General Public License for more details.
00018  *
00019  *  Read the full text in the LICENSE.GPL file in the doc directory.
00020  */
00021 
00022 
00023 #ifndef __FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
00024 #define __FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
00025 
00026 #include <fvutils/color/colorspaces.h>
00027 #include <fvutils/base/types.h>
00028 
00029 namespace firevision {
00030 #if 0 /* just to make Emacs auto-indent happy */
00031 }
00032 #endif
00033 
00034 class Qualifier
00035 {
00036  public:
00037   Qualifier();
00038   virtual ~Qualifier();
00039 
00040   /** Getter.
00041    * @param pixel the pixel of interest
00042    * @return a corresponding int value
00043    */
00044   virtual int   get(fawkes::point_t pixel) = 0;
00045 
00046   virtual unsigned char* get_buffer();
00047   virtual void set_buffer(unsigned char* buffer, unsigned int width = 0, 
00048                           unsigned int height = 0);
00049 
00050   virtual colorspace_t get_colorspace();
00051   virtual void set_colorspace(colorspace_t colorspace);
00052 
00053 
00054  protected:
00055   Qualifier(unsigned char* buffer, unsigned int width, 
00056             unsigned int height, colorspace_t colorspace);
00057 
00058   /** Image buffer */
00059   unsigned char* buffer_;
00060 
00061   /** Width of the buffer */
00062   unsigned int width_;
00063   /** Height of the buffer */
00064   unsigned int height_;
00065 
00066   /** Size of the buffer */
00067   unsigned int size_;
00068 
00069   /** Colorspace of the buffer */
00070   colorspace_t colorspace_;
00071 };
00072 
00073 
00074 class LumaQualifier: public Qualifier
00075 {
00076  public:
00077   LumaQualifier() {};
00078   LumaQualifier(unsigned char* buffer, unsigned int width, 
00079                 unsigned int height, colorspace_t colorspace);
00080   virtual ~LumaQualifier() {};
00081 
00082   virtual int   get(fawkes::point_t pixel);
00083 };
00084 
00085 
00086 class SkyblueQualifier: public Qualifier
00087 {
00088  public:
00089   SkyblueQualifier() {};
00090   SkyblueQualifier(unsigned char* buffer, unsigned int width, 
00091                    unsigned int height, colorspace_t colorspace);
00092   virtual ~SkyblueQualifier() {};
00093 
00094   virtual int   get(fawkes::point_t pixel);
00095 
00096 
00097  private:
00098   static const unsigned int threshold_ = 128; 
00099 };
00100 
00101 
00102 class YellowQualifier: public Qualifier
00103 {
00104  public:
00105   YellowQualifier() {};
00106   YellowQualifier(unsigned char* buffer, unsigned int width, 
00107                   unsigned int height, colorspace_t colorspace);
00108   virtual ~YellowQualifier() {};
00109 
00110   virtual int   get(fawkes::point_t pixel);
00111 
00112 
00113  private:
00114   static const unsigned int threshold_ = 100; 
00115 };
00116 
00117 } // end namespace firevision
00118 
00119 #endif // __FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_