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 namespace firevision {
00034 #if 0
00035 }
00036 #endif
00037
00038 class ColorObjectMap
00039 {
00040 public:
00041 ~ColorObjectMap();
00042 static const ColorObjectMap& get_instance() { return *__singleton; }
00043 static YUV_t get_color(color_t color);
00044
00045 const color_t& get(hint_t hint) const
00046 { return __color_for_hint.find(hint) != __color_for_hint.end() ? __color_for_hint.find(hint)->second : __c_other; }
00047 const hint_t get(color_t color) const
00048 { return __hint_for_color.find(color) != __hint_for_color.end() ? __hint_for_color.find(color)->second : __h_unknown; }
00049
00050 private:
00051 ColorObjectMap();
00052 void set_mapping(hint_t roi, color_t color);
00053
00054 static ColorObjectMap *__singleton;
00055 std::map<hint_t, color_t> __color_for_hint;
00056 std::map<color_t, hint_t> __hint_for_color;
00057 color_t __c_other;
00058 hint_t __h_unknown;
00059 };
00060
00061 }
00062
00063 #endif // __FIREVISION_MODELS_COLOR_COLOR_MAPPING_H__