27 #ifndef _FIREVISION_MODELS_COLOR_SIMILARITY_H_ 28 #define _FIREVISION_MODELS_COLOR_SIMILARITY_H_ 30 #include "colormodel.h" 32 #include <fvutils/color/rgb.h> 33 #include <fvutils/color/rgbyuv.h> 38 namespace firevision {
45 virtual color_t
determine(
unsigned int y,
unsigned int u,
unsigned int v)
const;
85 if (ref.at(0) > 0xff || ref.at(1) > 0xff || ref.at(2) > 0xff)
86 throw "invalid reference color";
87 int r = ref.at(0), g = ref.at(1), b = ref.at(2);
89 RGB2YUV(r, g, b, y, u, v);
105 std::vector<unsigned int> &v,
110 this->result = expect;
119 void add_colors(std::vector<color_class_t *> color_classes);
123 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.
struct firevision::ColorModelSimilarity::color_class_t color_class_t
Parameters that define a certain color.
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.
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.
void add_colors(std::vector< color_class_t * > color_classes)
Add multiple colors to this colormodel.