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>
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_;
Matches colors that are similar to given reference colors.
virtual const char * get_name()
Get name of color model.
void add_color(color_class_t *color_class)
Add a color to be recognized by this colormodel.
struct firevision::ColorModelSimilarity::color_class_t color_class_t
Parameters that define a certain color.
virtual color_t determine(unsigned int y, unsigned int u, unsigned int v) const
Determine the color class of a given YUV value.
void add_colors(std::vector< color_class_t * > color_classes)
Add multiple colors to this colormodel.
void delete_colors()
Remove all colors from this colormodel.
Parameters that define a certain color.
int chroma_threshold
Required chroma similarity.
int saturation_threshold
Required saturation.
void set_reference(std::vector< unsigned int > &ref)
Define the RGB values for the reference color.
int ref_v
YUV V-component of reference color.
color_t result
Discrete color_t represented by this class.
int ref_length
Length of U,V vector, i.e.
int luma_threshold
Required luminousity.
int ref_u
YUV U-component of reference color.
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_y
YUV Y-component of reference color.