Fawkes API  Fawkes Development Version
qualifiers.h
1 /***************************************************************************
2  * qualifiers.h - Pixel qualifier
3  *
4  * Created: Mon, 09. Jun 2008 22:54
5  * Copyright 2008 Christof Rath <c.rath@student.tugraz.at>
6  *
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 
23 #ifndef __FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
24 #define __FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
25 
26 #include <fvutils/color/colorspaces.h>
27 #include <fvutils/base/types.h>
28 
29 namespace firevision {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
34 class Qualifier
35 {
36  public:
37  Qualifier();
38  virtual ~Qualifier();
39 
40  /** Getter.
41  * @param pixel the pixel of interest
42  * @return a corresponding int value
43  */
44  virtual int get(fawkes::upoint_t pixel) = 0;
45 
46  virtual unsigned char* get_buffer();
47  virtual void set_buffer(unsigned char* buffer, unsigned int width = 0,
48  unsigned int height = 0);
49 
50  virtual colorspace_t get_colorspace();
51  virtual void set_colorspace(colorspace_t colorspace);
52 
53 
54  protected:
55  Qualifier(unsigned char* buffer, unsigned int width,
56  unsigned int height, colorspace_t colorspace);
57 
58  /** Image buffer */
59  unsigned char* buffer_;
60 
61  /** Width of the buffer */
62  unsigned int width_;
63  /** Height of the buffer */
64  unsigned int height_;
65 
66  /** Size of the buffer */
67  unsigned int size_;
68 
69  /** Colorspace of the buffer */
70  colorspace_t colorspace_;
71 };
72 
73 
74 class LumaQualifier: public Qualifier
75 {
76  public:
77  LumaQualifier() {};
78  LumaQualifier(unsigned char* buffer, unsigned int width,
79  unsigned int height, colorspace_t colorspace);
80  virtual ~LumaQualifier() {};
81 
82  virtual int get(fawkes::upoint_t pixel);
83 };
84 
85 
87 {
88  public:
89  SkyblueQualifier() {};
90  SkyblueQualifier(unsigned char* buffer, unsigned int width,
91  unsigned int height, colorspace_t colorspace);
92  virtual ~SkyblueQualifier() {};
93 
94  virtual int get(fawkes::upoint_t pixel);
95 
96 
97  private:
98  static const unsigned int threshold_ = 128;
99 };
100 
101 
103 {
104  public:
105  YellowQualifier() {};
106  YellowQualifier(unsigned char* buffer, unsigned int width,
107  unsigned int height, colorspace_t colorspace);
108  virtual ~YellowQualifier() {};
109 
110  virtual int get(fawkes::upoint_t pixel);
111 
112 
113  private:
114  static const unsigned int threshold_ = 100;
115 };
116 
117 } // end namespace firevision
118 
119 #endif // __FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
virtual void set_colorspace(colorspace_t colorspace)
colorspace setter
Definition: qualifiers.cpp:125
SkyblueQualifier for a single pixel.
Definition: qualifiers.h:86
LumaQualifier for a single pixel.
Definition: qualifiers.h:74
virtual void set_buffer(unsigned char *buffer, unsigned int width=0, unsigned int height=0)
buffer setter
Definition: qualifiers.cpp:93
virtual unsigned char * get_buffer()
Get buffer.
Definition: qualifiers.cpp:82
virtual colorspace_t get_colorspace()
Get colorspace.
Definition: qualifiers.cpp:115
unsigned int size_
Size of the buffer.
Definition: qualifiers.h:67
YellowQualifier for a single pixel.
Definition: qualifiers.h:102
unsigned int width_
Width of the buffer.
Definition: qualifiers.h:62
colorspace_t colorspace_
Colorspace of the buffer.
Definition: qualifiers.h:70
unsigned char * buffer_
Image buffer.
Definition: qualifiers.h:59
Point with cartesian coordinates as unsigned integers.
Definition: types.h:34
Qualifier()
Default constructor.
Definition: qualifiers.cpp:44
virtual ~Qualifier()
Destructor.
Definition: qualifiers.cpp:74
unsigned int height_
Height of the buffer.
Definition: qualifiers.h:64
Abstract Qualifier for a single pixel.
Definition: qualifiers.h:34