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/roi.h>
28#include <fvutils/base/types.h>
29#include <fvutils/color/yuv.h>
30
31#include <map>
32
33namespace firevision {
34
36{
37public:
39 static const ColorObjectMap &
41 {
42 return *singleton_;
43 }
44 static YUV_t get_color(color_t color);
45
46 color_t
47 get(hint_t hint) const
48 {
49 return color_for_hint_.find(hint) != color_for_hint_.end() ? color_for_hint_.find(hint)->second
50 : c_other_;
51 }
52 hint_t
53 get(color_t color) const
54 {
55 return hint_for_color_.find(color) != hint_for_color_.end()
56 ? hint_for_color_.find(color)->second
57 : h_unknown_;
58 }
59
60private:
62 void set_mapping(hint_t roi, color_t color);
63
64 static ColorObjectMap * singleton_;
65 std::map<hint_t, color_t> color_for_hint_;
66 std::map<color_t, hint_t> hint_for_color_;
67 color_t c_other_;
68 hint_t h_unknown_;
69};
70
71} // end namespace firevision
72
73#endif // FIREVISION_MODELS_COLOR_COLOR_MAPPING_H___
Color mapping class.
static YUV_t get_color(color_t color)
YUV_t getter.
color_t get(hint_t hint) const
Inline color_t reference getter.
hint_t get(color_t color) const
Inline hint_t(ROI) reference getter.
static const ColorObjectMap & get_instance()
ColorObjectMap getter.
YUV pixel.
Definition: yuv.h:58