25 #ifndef FIREVISION_UTILS_COLOR_RGB_H_
26 #define FIREVISION_UTILS_COLOR_RGB_H_
28 namespace firevision {
30 #define RGB_PIXEL_SIZE 3
31 #define RGB_PIXEL_AT(RGB, width, x, y) \
32 ((RGB_t *)(RGB + ((y) * (width)*RGB_PIXEL_SIZE) + (x)*RGB_PIXEL_SIZE))
33 #define RGB_CLEAR_PIXEL(RGB, width, x, y) \
34 memset(RGB + ((y) * (width)*RGB_PIXEL_SIZE) + (x)*RGB_PIXEL_SIZE, 0, RGB_PIXEL_SIZE);
35 #define RGB_RED_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->R)
36 #define RGB_GREEN_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->G)
37 #define RGB_BLUE_AT(RGB, width, x, y) (RGB_PIXEL_AT(RGB, (width), (x), (y))->B)
38 #define RGB_SET_RED(RGB, width, x, y) \
40 RGB_t *p = RGB_PIXEL_AT(RGB, (width), (x), (y)); \
45 #define RGB_SET_GREEN(RGB, width, x, y) \
47 RGB_t *p = RGB_PIXEL_AT(RGB, (width), (x), (y)); \
52 #define RGB_SET_BLUE(RGB, width, x, y) \
54 RGB_t *p = RGB_PIXEL_AT(RGB, (width), (x), (y)); \
76 void rgb_to_rgb_with_alpha_plainc(
const unsigned char *rgb,
77 unsigned char * rgb_alpha,
81 void rgb_to_rgb_planar_plainc(
const unsigned char *rgb,
82 unsigned char * rgb_planar,
83 const unsigned int width,
84 const unsigned int height);
86 void rgb_planar_to_rgb_plainc(
const unsigned char *rgb_planar,
88 const unsigned int width,
89 const unsigned int height);
91 void rgb_to_bgr_with_alpha_plainc(
const unsigned char *rgb,
92 unsigned char * bgr_alpha,
96 void gray8_to_rgb_plainc(
const unsigned char *mono8,
101 void rgb_to_rgbfloat(
const unsigned char *rgb,
102 unsigned char * rgb_float,
104 unsigned int height);
106 void rgbfloat_to_rgb(
const unsigned char *rgb_float,
109 unsigned int height);
111 void bgr_to_rgb_plainc(
const unsigned char *BGR,
114 unsigned int height);
116 void convert_line_bgr_rgb(
const unsigned char *BGR,
119 unsigned int height);