color_object_map.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__
00025 #define __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__
00026
00027 #include <fvutils/base/types.h>
00028 #include <fvutils/base/roi.h>
00029 #include <fvutils/color/yuv.h>
00030
00031 #include <map>
00032
00033 class ColorObjectMap
00034 {
00035 public:
00036 ~ColorObjectMap();
00037 static const ColorObjectMap& get_instance() { return *__singleton; }
00038 static YUV_t get_color(color_t color);
00039
00040 const color_t& get(hint_t hint) const
00041 { return __color_for_hint.find(hint) != __color_for_hint.end() ? __color_for_hint.find(hint)->second : __c_other; }
00042 const hint_t get(color_t color) const
00043 { return __hint_for_color.find(color) != __hint_for_color.end() ? __hint_for_color.find(color)->second : __h_unknown; }
00044
00045 private:
00046 ColorObjectMap();
00047 void set_mapping(hint_t roi, color_t color);
00048
00049 static ColorObjectMap *__singleton;
00050 std::map<hint_t, color_t> __color_for_hint;
00051 std::map<color_t, hint_t> __hint_for_color;
00052 color_t __c_other;
00053 hint_t __h_unknown;
00054 };
00055
00056 #endif // __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__