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 <fvmodels/color/thresholds_luminance.h>
26 
27 #include <iostream>
28 
29 using namespace std;
30 
31 namespace firevision {
32 
33 /** @class ColorModelLuminance <fvmodels/color/thresholds_luminance.h>
34  * Really simple thresholds-based model with some hard-coded thresholds. Was
35  * just for initial development of color models.
36  */
37 
38 /** Constructor.
39  * @param threshold_white_low minimum luminance value to mark color
40  */
41 ColorModelLuminance::ColorModelLuminance(const unsigned int threshold_white_low)
42 {
43  threshold_white_low_ = threshold_white_low;
44 }
45 
46 color_t
47 ColorModelLuminance::determine(unsigned int y, unsigned int u, unsigned int v) const
48 {
49  if (y >= threshold_white_low_) {
50  return C_WHITE;
51  } else {
52  return C_OTHER;
53  }
54 }
55 
56 const char *
57 ColorModelLuminance::get_name()
58 {
59  return "ColorModelLuminance";
60 }
61 
62 /** Print the thresholds to stdout.
63  */
64 void
65 ColorModelLuminance::print_thresholds()
66 {
67  cout << "ColorModelLuminance" << endl
68  << "==========================================================" << endl
69  << "White: y_low=" << threshold_white_low_ << endl;
70 }
71 
72 } // end namespace firevision