28 #ifndef __FIREVISION_MODELS_COLOR_SIMILARITY_H_ 29 #define __FIREVISION_MODELS_COLOR_SIMILARITY_H_ 31 #include "colormodel.h" 32 #include <fvutils/color/rgb.h> 33 #include <fvutils/color/rgbyuv.h> 45 virtual color_t
determine(
unsigned int y,
unsigned int u,
46 unsigned int v)
const;
83 if (ref.at(0) > 0xff || ref.at(1) > 0xff || ref.at(2) > 0xff)
84 throw "invalid reference color";
85 int r = ref.at(0), g = ref.at(1), b = ref.at(2);
87 RGB2YUV(r, g, b, y, u, v);
91 ref_length = sqrt(ref_u * ref_u + ref_v * ref_v);
102 color_class_t(color_t expect, std::vector<unsigned int> &v,
int chroma_threshold,
int saturation_threshold,
103 int luma_threshold = 0) {
104 this->result = expect;
113 void add_colors(std::vector<color_class_t *> color_classes);
117 std::vector<color_class_t *> color_classes_;
Parameters that define a certain color.
void add_color(color_class_t *color_class)
Add a color to be recognized by this colormodel.
int ref_v
YUV V-component of reference color.
int saturation_threshold
Required saturation.
virtual color_t determine(unsigned int y, unsigned int u, unsigned int v) const
Determine the color class of a given YUV value.
int ref_u
YUV U-component of reference color.
void delete_colors()
Remove all colors from this colormodel.
int luma_threshold
Required luminousity.
color_class_t(color_t expect, std::vector< unsigned int > &v, int chroma_threshold, int saturation_threshold, int luma_threshold=0)
Initialize a color class.
void add_colors(std::vector< color_class_t *> color_classes)
Add multiple colors to this colormodel.
int ref_length
Length of U,V vector, i.e.
int ref_y
YUV Y-component of reference color.
void set_reference(std::vector< unsigned int > &ref)
Define the RGB values for the reference color.
int chroma_threshold
Required chroma similarity.
color_t result
Discrete color_t represented by this class.
virtual const char * get_name()
Get name of color model.
Matches colors that are similar to given reference colors.