23 #include <fvclassifiers/qualifiers.h> 24 #include <core/exceptions/software.h> 25 #include <fvutils/color/yuv.h> 44 Qualifier::Qualifier()
50 colorspace_ = CS_UNKNOWN;
59 Qualifier::Qualifier(
unsigned char* buffer,
unsigned int width,
60 unsigned int height, colorspace_t colorspace)
64 if (!width || !height)
67 set_buffer(buffer, width, height);
68 colorspace_ = colorspace;
74 Qualifier::~Qualifier()
82 Qualifier::get_buffer()
93 Qualifier::set_buffer(
unsigned char* buffer,
unsigned int width,
105 size_ = width_ * height_;
115 Qualifier::get_colorspace()
125 Qualifier::set_colorspace(colorspace_t colorspace)
127 colorspace_ = colorspace;
149 LumaQualifier::LumaQualifier(
unsigned char* buffer,
unsigned int width,
150 unsigned int height, colorspace_t colorspace)
151 :
Qualifier(buffer, width, height, colorspace)
189 SkyblueQualifier::SkyblueQualifier(
unsigned char* buffer,
unsigned int width,
190 unsigned int height, colorspace_t colorspace)
191 :
Qualifier(buffer, width, height, colorspace)
208 unsigned int u_addr =
size_ + (pixel.
y *
width_ + pixel.
x) / 2;
209 unsigned char u =
buffer_[u_addr];
212 if ((u < threshold_) || (v < threshold_))
236 YellowQualifier::YellowQualifier(
unsigned char* buffer,
unsigned int width,
237 unsigned int height, colorspace_t colorspace)
238 :
Qualifier(buffer, width, height, colorspace)
255 unsigned int y_addr = (pixel.
y *
width_ + pixel.
x);
256 unsigned int u_addr =
size_ + y_addr / 2;
257 unsigned char y =
buffer_[y_addr];
258 unsigned int u = (255 -
buffer_[u_addr]) * y;
259 unsigned int v = (255 - abs(127 -
buffer_[u_addr +
size_ / 2]) * 2) * y;
261 if ((u <= threshold_) || (v <= threshold_))
virtual int get(fawkes::upoint_t pixel)
Getter.
unsigned int y
y coordinate
unsigned int x
x coordinate
A NULL pointer was supplied where not allowed.
virtual int get(fawkes::upoint_t pixel)
Getter.
unsigned int size_
Size of the buffer.
virtual int get(fawkes::upoint_t pixel)
Getter.
unsigned int width_
Width of the buffer.
unsigned char * buffer_
Image buffer.
Point with cartesian coordinates as unsigned integers.
Expected parameter is missing.
unsigned int height_
Height of the buffer.
Abstract Qualifier for a single pixel.