Fawkes API  Fawkes Development Version
thresholds.h
1 
2 /**************************************************************************
3  * thresholds.h - This header defines thresholds for color classification
4  *
5  * Created: Wed May 11 11:22:00 2005
6  * Copyright 2005 Martin Heracles <Martin.Heracles@rwth-aachen.de>
7  * Tim Niemueller [www.niemueller.de]
8  *
9  ***************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef __FIREVISION_COLORMODEL_THRESHOLDS_H_
26 #define __FIREVISION_COLORMODEL_THRESHOLDS_H_
27 
28 #include <fvmodels/color/colormodel.h>
29 
30 namespace firevision {
31 #if 0 /* just to make Emacs auto-indent happy */
32 }
33 #endif
34 
35 /* The following thresholds define certain color regions in the
36  two-dimensional UV-Colorspace (ignoring the Y-component).
37  It is assumed that the Y-, U- and V-components range from 0 to 255 each,
38  and that (0, 0) is at the lower left corner. */
39 
40 // 1/8 * 255 = 31
41 #define THRESHOLD_ORANGE_U_LOW 0
42 
43 // 3/8 * 255 = 94
44 #define THRESHOLD_ORANGE_U_HIGH 120
45 
46 // 3/4 * 255 = 191
47 #define THRESHOLD_ORANGE_V_LOW 170
48 
49 // 5/8 * 255
50 #define THRESHOLD_MAGENTA_U_LOW 159
51 
52 // 5/8 * 255
53 #define THRESHOLD_MAGENTA_V_LOW 159
54 
55 //1/4 * 255
56 #define THRESHOLD_CYAN_U_LOW 63
57 
58 // 5/8 * 255
59 #define THRESHOLD_CYAN_U_HIGH 159
60 
61 //1/4 * 255
62 #define THRESHOLD_CYAN_V_HIGH 63
63 
64 // 3/4 * 255
65 #define THRESHOLD_BLUE_U_LOW 191
66 
67 // 0 :-)
68 #define THRESHOLD_BLUE_V_HIGH 90
69 
70 // 1/8 * 255
71 #define THRESHOLD_YELLOW_U_HIGH 31
72 
73 // 3/4 * 255
74 #define THRESHOLD_YELLOW_V_LOW 191
75 
76 //1/4 * 255
77 #define THRESHOLD_GREEN_U_HIGH 63
78 
79 // 5/8 * 255
80 #define THRESHOLD_GREEN_V_HIGH 159
81 
82 // 2/3 * 255
83 #define THRESHOLD_WHITE_Y_LOW 170
84 
85 
87 {
88  public:
89 
90  color_t determine(unsigned int y,
91  unsigned int u,
92  unsigned int v) const;
93 
94  const char * get_name();
95  void print_thresholds();
96 
97 };
98 
99 } // end namespace firevision
100 
101 #endif
Color model interface.
Definition: colormodel.h:34
color_t determine(unsigned int y, unsigned int u, unsigned int v) const
Determine classification of YUV pixel.
Definition: thresholds.cpp:42
Really simple thresholds-based model with some hard-coded thresholds.
Definition: thresholds.h:86
const char * get_name()
Get name of color model.
Definition: thresholds.cpp:81
void print_thresholds()
Print the thresholds to stdout.
Definition: thresholds.cpp:90