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
28namespace firevision {
29
31{
32public:
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
48protected:
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
70{
71public:
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{
84public:
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
94private:
95 static const unsigned int threshold_ = 128;
96};
97
99{
100public:
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
110private:
111 static const unsigned int threshold_ = 100;
112};
113
114} // end namespace firevision
115
116#endif // FIREVISION_APPS_NAO_LOC_QUALIFIERS_H__
LumaQualifier for a single pixel.
Definition: qualifiers.h:70
virtual int get(fawkes::upoint_t pixel)
Getter.
Definition: qualifiers.cpp:149
Abstract Qualifier for a single pixel.
Definition: qualifiers.h:31
unsigned int size_
Size of the buffer.
Definition: qualifiers.h:63
Qualifier()
Default constructor.
Definition: qualifiers.cpp:41
unsigned int width_
Width of the buffer.
Definition: qualifiers.h:58
virtual colorspace_t get_colorspace()
Get colorspace.
Definition: qualifiers.cpp:109
unsigned int height_
Height of the buffer.
Definition: qualifiers.h:60
virtual unsigned char * get_buffer()
Get buffer.
Definition: qualifiers.cpp:80
colorspace_t colorspace_
Colorspace of the buffer.
Definition: qualifiers.h:66
virtual void set_colorspace(colorspace_t colorspace)
colorspace setter
Definition: qualifiers.cpp:118
virtual int get(fawkes::upoint_t pixel)=0
Getter.
virtual void set_buffer(unsigned char *buffer, unsigned int width=0, unsigned int height=0)
buffer setter
Definition: qualifiers.cpp:91
unsigned char * buffer_
Image buffer.
Definition: qualifiers.h:55
virtual ~Qualifier()
Destructor.
Definition: qualifiers.cpp:72
SkyblueQualifier for a single pixel.
Definition: qualifiers.h:83
virtual int get(fawkes::upoint_t pixel)
Getter.
Definition: qualifiers.cpp:191
YellowQualifier for a single pixel.
Definition: qualifiers.h:99
virtual int get(fawkes::upoint_t pixel)
Getter.
Definition: qualifiers.cpp:240
Point with cartesian coordinates as unsigned integers.
Definition: types.h:35