23 #include <fvfilters/colorthreshold.h> 24 #include <fvutils/color/rgbyuv.h> 25 #include <fvutils/color/threshold.h> 26 #include <fvutils/color/yuv.h> 30 namespace firevision {
33 :
Filter(
"FilterColorThreshold", 1), color_model_(color_model)
37 FilterColorThreshold::~FilterColorThreshold()
49 unsigned char *p_src_u =
53 unsigned char *p_src_v =
58 unsigned char *p_dst_y =
60 unsigned char *p_dst_u =
63 unsigned char *p_dst_v =
67 unsigned const char *p_line_src_y = p_src_y, *p_line_src_u = p_src_u, *p_line_src_v = p_src_v,
68 *p_line_dst_y = p_dst_y, *p_line_dst_u = p_dst_u, *p_line_dst_v = p_dst_v;
70 for (h = 0; (h <
src_roi[0]->
height) && (h < dst_roi->height); ++h) {
71 for (w = 0; (w <
src_roi[0]->
width) && (w < dst_roi->width); w += 2) {
73 *p_dst_y++ = *p_src_y++;
74 *p_dst_y++ = *p_src_y++;
76 if (color_model_->
determine(*p_src_y, *p_src_u, *p_src_v) != C_OTHER) {
77 *p_dst_u++ = *p_src_u;
78 *p_dst_v++ = *p_src_v;
virtual color_t determine(unsigned int y, unsigned int u, unsigned int v) const
Determine the color class of a given YUV value.
fawkes::upoint_t start
ROI start.
unsigned int y
y coordinate
unsigned int x
x coordinate
unsigned int width
ROI width.
unsigned int image_width
width of image that contains this ROI
unsigned char ** src
Source buffers, dynamically allocated by Filter ctor.
unsigned int image_height
height of image that contains this ROI
ROI ** src_roi
Source ROIs, dynamically allocated by Filter ctor.
unsigned int height
ROI height.
FilterColorThreshold(ColorModelSimilarity *color_model)
Constructor.
unsigned int line_step
line step
virtual void apply()
Apply the filter.
unsigned char * dst
Destination buffer.
unsigned int pixel_step
pixel step
ROI * dst_roi
Destination ROI.
Matches colors that are similar to given reference colors.