24 #include <fvutils/colormap/colormap.h>
26 #include <fvutils/color/color_object_map.h>
29 namespace firevision {
111 Colormap::~Colormap()
129 Colormap::to_image(
unsigned char *yuv422_planar_buffer,
unsigned int level)
131 unsigned int iwidth = image_width() / 2;
132 unsigned int iheight = image_height() / 2;
134 unsigned int lwidth = width();
135 unsigned int lheight = height();
137 unsigned int pixel_per_step = iheight / lheight;
138 unsigned int lines_per_step = iwidth / lwidth;
140 unsigned char *yp = yuv422_planar_buffer;
141 unsigned char *up = YUV422_PLANAR_U_PLANE(yuv422_planar_buffer, iwidth * 2, iheight * 2);
142 unsigned char *vp = YUV422_PLANAR_V_PLANE(yuv422_planar_buffer, iwidth * 2, iheight * 2);
144 unsigned int y = level * deepness() / depth();
147 for (
unsigned int v = lwidth; v > 0 ; --v) {
148 unsigned int v_index = (v - 1) * deepness() / lwidth;
149 for (
unsigned int u = 0; u < lheight; ++u) {
150 unsigned int u_index = u * deepness() / lheight;
151 c = ColorObjectMap::get_color(determine(y, u_index, v_index));
153 for (
unsigned int p = 0; p < pixel_per_step; ++p) {
161 unsigned int lines = (2 * (lines_per_step - 1)) + 1;
162 memcpy(yp, (yp - iwidth * 2), (iwidth * 2) * lines);
163 yp += (iwidth * 2) * lines;
164 memcpy(up, (up - iwidth), iwidth * lines);
165 memcpy(vp, (vp - iwidth), iwidth * lines);
166 up += iwidth * lines;
167 vp += iwidth * lines;
176 Colormap::image_width()
const
186 Colormap::image_height()
const
unsigned char V
V component.
unsigned char Y
Y component.
unsigned char U
U component.