Fawkes API  Fawkes Development Version
thresholds_luminance.cpp
1 
2 /***************************************************************************
3  * thresholds.cpp - Implementation of a thresholds color model
4  *
5  * Created: Wed May 18 13:59:18 2005
6  * Copyright 2005 Tim Niemueller [www.niemueller.de]
7  * Matrin Heracles <martin.heracles@rwth-aachen.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 #include <iostream>
26 
27 #include <fvmodels/color/thresholds_luminance.h>
28 
29 using namespace std;
30 
31 namespace firevision {
32 #if 0 /* just to make Emacs auto-indent happy */
33 }
34 #endif
35 
36 /** @class ColorModelLuminance <fvmodels/color/thresholds_luminance.h>
37  * Really simple thresholds-based model with some hard-coded thresholds. Was
38  * just for initial development of color models.
39  */
40 
41 /** Constructor.
42  * @param threshold_white_low minimum luminance value to mark color
43  */
44 ColorModelLuminance::ColorModelLuminance(const unsigned int threshold_white_low)
45 {
46  threshold_white_low_ = threshold_white_low;
47 }
48 
49 color_t
50 ColorModelLuminance::determine(unsigned int y,
51  unsigned int u,
52  unsigned int v) const
53 {
54  if ( y >= threshold_white_low_) {
55  return C_WHITE;
56  }
57  else {
58  return C_OTHER;
59  }
60 }
61 
62 const char *
63 ColorModelLuminance::get_name()
64 {
65  return "ColorModelLuminance";
66 }
67 
68 
69 /** Print the thresholds to stdout.
70  */
71 void
72 ColorModelLuminance::print_thresholds()
73 {
74  cout << "ColorModelLuminance" << endl
75  << "==========================================================" << endl
76  << "White: y_low=" << threshold_white_low_
77  << endl;
78 }
79 
80 } // end namespace firevision
STL namespace.