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
30namespace firevision {
31
32/* The following thresholds define certain color regions in the
33 two-dimensional UV-Colorspace (ignoring the Y-component).
34 It is assumed that the Y-, U- and V-components range from 0 to 255 each,
35 and that (0, 0) is at the lower left corner. */
36
37// 1/8 * 255 = 31
38#define THRESHOLD_ORANGE_U_LOW 0
39
40// 3/8 * 255 = 94
41#define THRESHOLD_ORANGE_U_HIGH 120
42
43// 3/4 * 255 = 191
44#define THRESHOLD_ORANGE_V_LOW 170
45
46// 5/8 * 255
47#define THRESHOLD_MAGENTA_U_LOW 159
48
49// 5/8 * 255
50#define THRESHOLD_MAGENTA_V_LOW 159
51
52//1/4 * 255
53#define THRESHOLD_CYAN_U_LOW 63
54
55// 5/8 * 255
56#define THRESHOLD_CYAN_U_HIGH 159
57
58//1/4 * 255
59#define THRESHOLD_CYAN_V_HIGH 63
60
61// 3/4 * 255
62#define THRESHOLD_BLUE_U_LOW 191
63
64// 0 :-)
65#define THRESHOLD_BLUE_V_HIGH 90
66
67// 1/8 * 255
68#define THRESHOLD_YELLOW_U_HIGH 31
69
70// 3/4 * 255
71#define THRESHOLD_YELLOW_V_LOW 191
72
73//1/4 * 255
74#define THRESHOLD_GREEN_U_HIGH 63
75
76// 5/8 * 255
77#define THRESHOLD_GREEN_V_HIGH 159
78
79// 2/3 * 255
80#define THRESHOLD_WHITE_Y_LOW 170
81
83{
84public:
85 color_t determine(unsigned int y, unsigned int u, unsigned int v) const;
86
87 const char *get_name();
88 void print_thresholds();
89};
90
91} // end namespace firevision
92
93#endif
Really simple thresholds-based model with some hard-coded thresholds.
Definition: thresholds.h:83
const char * get_name()
Get name of color model.
Definition: thresholds.cpp:64
void print_thresholds()
Print the thresholds to stdout.
Definition: thresholds.cpp:72
color_t determine(unsigned int y, unsigned int u, unsigned int v) const
Determine classification of YUV pixel.
Definition: thresholds.cpp:39
Color model interface.
Definition: colormodel.h:32