27 #include "similarity.h" 29 #include <fvutils/color/yuv.h> 30 #include <fvutils/color/threshold.h> 42 ColorModelSimilarity::ColorModelSimilarity() {}
45 return "ColorModelSimilarity";
59 for(std::vector<color_class_t *>::const_iterator it = color_classes_.begin();
60 it != color_classes_.end(); it++) {
61 if((*it)->luma_threshold >= 0) {
62 if (is_similar_y(y, u - 0x80, v - 0x80,
63 (*it)->ref_y, (*it)->ref_u, (*it)->ref_v, (*it)->ref_length,
64 (*it)->chroma_threshold, (*it)->saturation_threshold, (*it)->luma_threshold)) {
69 if(is_similar(u - 0x80, v - 0x80,
70 (*it)->ref_u, (*it)->ref_v, (*it)->ref_length,
71 (*it)->chroma_threshold, (*it)->saturation_threshold)) {
84 color_classes_.push_back(color_class);
91 color_classes_.insert(color_classes_.end(), color_classes.begin(), color_classes.end());
97 color_classes_.clear();
Parameters that define a certain color.
void add_color(color_class_t *color_class)
Add a color to be recognized by this colormodel.
virtual color_t determine(unsigned int y, unsigned int u, unsigned int v) const
Determine the color class of a given YUV value.
void delete_colors()
Remove all colors from this colormodel.
void add_colors(std::vector< color_class_t *> color_classes)
Add multiple colors to this colormodel.
virtual const char * get_name()
Get name of color model.