22 #include <fvfilters/colorthreshold.h> 23 #include <fvutils/color/rgbyuv.h> 24 #include <fvutils/color/yuv.h> 25 #include <fvutils/color/threshold.h> 36 :
Filter(
"FilterColorThreshold", 1),
37 color_model_(color_model)
40 FilterColorThreshold::~FilterColorThreshold() {
45 register unsigned int h = 0;
46 register unsigned int w = 0;
49 register unsigned char *p_src_u = YUV422_PLANAR_U_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
51 register unsigned char *p_src_v = YUV422_PLANAR_V_PLANE(
src[0],
src_roi[0]->image_width,
src_roi[0]->image_height)
60 unsigned const char *p_line_src_y = p_src_y,
61 *p_line_src_u = p_src_u,
62 *p_line_src_v = p_src_v,
63 *p_line_dst_y = p_dst_y,
64 *p_line_dst_u = p_dst_u,
65 *p_line_dst_v = p_dst_v;
67 for (h = 0; (h <
src_roi[0]->
height) && (h < dst_roi->height); ++h) {
68 for (w = 0; (w <
src_roi[0]->
width) && (w < dst_roi->width); w += 2) {
71 *p_dst_y++ = *p_src_y++;
72 *p_dst_y++ = *p_src_y++;
74 if (color_model_->
determine(*p_src_y, *p_src_u, *p_src_v) != C_OTHER) {
75 *p_dst_u++ = *p_src_u;
76 *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.