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 #ifndef _FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
23 #define _FIREVISION_APPS_NAO_LOC_QUALIFIERS_H_
24 
25 #include <fvutils/base/types.h>
26 #include <fvutils/color/colorspaces.h>
27 
28 namespace firevision {
29 
30 class Qualifier
31 {
32 public:
33  Qualifier();
34  virtual ~Qualifier();
35 
36  /** Getter.
37  * @param pixel the pixel of interest
38  * @return a corresponding int value
39  */
40  virtual int get(fawkes::upoint_t pixel) = 0;
41 
42  virtual unsigned char *get_buffer();
43  virtual void set_buffer(unsigned char *buffer, unsigned int width = 0, unsigned int height = 0);
44 
45  virtual colorspace_t get_colorspace();
46  virtual void set_colorspace(colorspace_t colorspace);
47 
48 protected:
49  Qualifier(unsigned char *buffer,
50  unsigned int width,
51  unsigned int height,
52  colorspace_t colorspace);
53 
54  /** Image buffer */
55  unsigned char *buffer_;
56 
57  /** Width of the buffer */
58  unsigned int width_;
59  /** Height of the buffer */
60  unsigned int height_;
61 
62  /** Size of the buffer */
63  unsigned int size_;
64 
65  /** Colorspace of the buffer */
66  colorspace_t colorspace_;
67 };
68 
69 class LumaQualifier : public Qualifier
70 {
71 public:
72  LumaQualifier(){};
73  LumaQualifier(unsigned char *buffer,
74  unsigned int width,
75  unsigned int height,
76  colorspace_t colorspace);
77  virtual ~LumaQualifier(){};
78 
79  virtual int get(fawkes::upoint_t pixel);
80 };
81 
83 {
84 public:
85  SkyblueQualifier(){};
86  SkyblueQualifier(unsigned char *buffer,
87  unsigned int width,
88  unsigned int height,
89  colorspace_t colorspace);
90  virtual ~SkyblueQualifier(){};
91 
92  virtual int get(fawkes::upoint_t pixel);
93 
94 private:
95  static const unsigned int threshold_ = 128;
96 };
97 
98 class YellowQualifier : public Qualifier
99 {
100 public:
101  YellowQualifier(){};
102  YellowQualifier(unsigned char *buffer,
103  unsigned int width,
104  unsigned int height,
105  colorspace_t colorspace);
106  virtual ~YellowQualifier(){};
107 
108  virtual int get(fawkes::upoint_t pixel);
109 
110 private:
111  static const unsigned int threshold_ = 100;
112 };
113 
114 } // end namespace firevision
115 
116 #endif // FIREVISION_APPS_NAO_LOC_QUALIFIERS_H__
firevision::Qualifier::buffer_
unsigned char * buffer_
Image buffer.
Definition: qualifiers.h:55
firevision::Qualifier::size_
unsigned int size_
Size of the buffer.
Definition: qualifiers.h:63
firevision::YellowQualifier::get
virtual int get(fawkes::upoint_t pixel)
Getter.
Definition: qualifiers.cpp:240
firevision::Qualifier::get_colorspace
virtual colorspace_t get_colorspace()
Get colorspace.
Definition: qualifiers.cpp:109
fawkes::upoint_t
Point with cartesian coordinates as unsigned integers.
Definition: types.h:35
firevision::Qualifier::colorspace_
colorspace_t colorspace_
Colorspace of the buffer.
Definition: qualifiers.h:66
firevision::YellowQualifier
YellowQualifier for a single pixel.
Definition: qualifiers.h:99
firevision::SkyblueQualifier::get
virtual int get(fawkes::upoint_t pixel)
Getter.
Definition: qualifiers.cpp:191
firevision::Qualifier
Abstract Qualifier for a single pixel.
Definition: qualifiers.h:31
firevision::Qualifier::get_buffer
virtual unsigned char * get_buffer()
Get buffer.
Definition: qualifiers.cpp:80
firevision::SkyblueQualifier
SkyblueQualifier for a single pixel.
Definition: qualifiers.h:83
firevision::LumaQualifier::get
virtual int get(fawkes::upoint_t pixel)
Getter.
Definition: qualifiers.cpp:149
firevision::Qualifier::width_
unsigned int width_
Width of the buffer.
Definition: qualifiers.h:58
firevision::Qualifier::set_colorspace
virtual void set_colorspace(colorspace_t colorspace)
colorspace setter
Definition: qualifiers.cpp:118
firevision::Qualifier::Qualifier
Qualifier()
Default constructor.
Definition: qualifiers.cpp:41
firevision::Qualifier::~Qualifier
virtual ~Qualifier()
Destructor.
Definition: qualifiers.cpp:72
firevision::Qualifier::get
virtual int get(fawkes::upoint_t pixel)=0
Getter.
firevision::Qualifier::height_
unsigned int height_
Height of the buffer.
Definition: qualifiers.h:60
firevision::LumaQualifier
LumaQualifier for a single pixel.
Definition: qualifiers.h:70
firevision::Qualifier::set_buffer
virtual void set_buffer(unsigned char *buffer, unsigned int width=0, unsigned int height=0)
buffer setter
Definition: qualifiers.cpp:91