Fawkes API  Fawkes Development Version
color_object_map.h
1 
2 /***************************************************************************
3  * color_object_map.h - Mapping between color and roi
4  *
5  * Created: Mon May 16th 2008
6  * Copyright 2008 Christof Rath <c.rath@student.tugraz.at>
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__
25 #define __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__
26 
27 #include <fvutils/base/types.h>
28 #include <fvutils/base/roi.h>
29 #include <fvutils/color/yuv.h>
30 
31 #include <map>
32 
33 namespace firevision {
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
39 {
40  public:
42  static const ColorObjectMap& get_instance() { return *__singleton; }
43  static YUV_t get_color(color_t color);
44 
45  const color_t& get(hint_t hint) const
46  { return __color_for_hint.find(hint) != __color_for_hint.end() ? __color_for_hint.find(hint)->second : __c_other; }
47  const hint_t get(color_t color) const
48  { return __hint_for_color.find(color) != __hint_for_color.end() ? __hint_for_color.find(color)->second : __h_unknown; }
49 
50  private:
52  void set_mapping(hint_t roi, color_t color);
53 
54  static ColorObjectMap *__singleton;
55  std::map<hint_t, color_t> __color_for_hint;
56  std::map<color_t, hint_t> __hint_for_color;
57  color_t __c_other;
58  hint_t __h_unknown;
59 };
60 
61 } // end namespace firevision
62 
63 #endif // __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__
static const ColorObjectMap & get_instance()
ColorObjectMap getter.
Color mapping class.
YUV pixel.
Definition: yuv.h:59
static YUV_t get_color(color_t color)
YUV_t getter.