54 #include <visp3/core/vpImageConvert.h> 55 #include <Simd/SimdLib.hpp> 57 bool vpImageConvert::YCbCrLUTcomputed =
false;
58 int vpImageConvert::vpCrr[256];
59 int vpImageConvert::vpCgb[256];
60 int vpImageConvert::vpCgr[256];
61 int vpImageConvert::vpCbb[256];
109 for (
unsigned int i = 0; i < max_xy; i++) {
110 float val = 255.f * (src.
bitmap[i] - min) / (max - min);
116 dest.
bitmap[i] = (
unsigned char)val;
146 for (
unsigned int i = 0; i < max_xy; i++) {
147 double val = 255. * (src.
bitmap[i] - min) / (max - min);
153 dest.
bitmap[i] = (
unsigned char)val;
166 for (
unsigned int i = 0; i < src.
getSize(); i++)
179 for (
unsigned int i = 0; i < src.
getSize(); i++)
180 dest.
bitmap[i] = static_cast<unsigned char>(src.
bitmap[i] << 8);
205 static uint32_t histogram[0x10000];
206 memset(histogram, 0,
sizeof(histogram));
208 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i)
209 ++histogram[src_depth.
bitmap[i]];
210 for (
int i = 2; i < 0x10000; ++i)
211 histogram[i] += histogram[i - 1];
214 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i) {
215 uint16_t d = src_depth.
bitmap[i];
217 unsigned char f = (
unsigned char)(histogram[d] * 255 / histogram[0xFFFF]);
218 dest_rgba.
bitmap[i].
R = 255 - f;
240 static uint32_t histogram2[0x10000];
241 memset(histogram2, 0,
sizeof(histogram2));
243 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i)
244 ++histogram2[src_depth.
bitmap[i]];
245 for (
int i = 2; i < 0x10000; ++i)
246 histogram2[i] += histogram2[i - 1];
249 for (
unsigned int i = 0; i < src_depth.
getSize(); ++i) {
250 uint16_t d = src_depth.
bitmap[i];
252 unsigned char f =
static_cast<unsigned char>(histogram2[d] * 255 / histogram2[0xFFFF]);
260 #ifdef VISP_HAVE_OPENCV 309 int nChannel = src->nChannels;
310 int depth = src->depth;
311 int height = src->height;
312 int width = src->width;
313 int widthStep = src->widthStep;
314 int lineStep = (flip) ? 1 : 0;
316 if (nChannel == 3 && depth == 8) {
317 dest.
resize((
unsigned int)height, (
unsigned int)width);
320 unsigned char *input = (
unsigned char *)src->imageData;
321 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
323 for (
int i = 0; i < height; i++) {
324 unsigned char *line = input;
325 unsigned char *output = beginOutput + lineStep * (4 * width * (height - 1 - i)) + (1 - lineStep) * 4 * width * i;
326 for (
int j = 0; j < width; j++) {
327 *(output++) = *(line + 2);
328 *(output++) = *(line + 1);
329 *(output++) = *(line);
337 }
else if (nChannel == 1 && depth == 8) {
338 dest.
resize((
unsigned int)height, (
unsigned int)width);
340 unsigned char *input = (
unsigned char *)src->imageData;
341 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
343 for (
int i = 0; i < height; i++) {
344 unsigned char *line = input;
345 unsigned char *output = beginOutput + lineStep * (4 * width * (height - 1 - i)) + (1 - lineStep) * 4 * width * i;
346 for (
int j = 0; j < width; j++) {
404 int nChannel = src->nChannels;
405 int depth = src->depth;
406 int height = src->height;
407 int width = src->width;
408 int widthStep = src->widthStep;
409 int lineStep = (flip) ? 1 : 0;
412 if (widthStep == width) {
413 if (nChannel == 1 && depth == 8) {
414 dest.
resize((
unsigned int)height, (
unsigned int)width);
415 memcpy(dest.
bitmap, src->imageData, (
size_t)(height * width));
417 if (nChannel == 3 && depth == 8) {
418 dest.
resize((
unsigned int)height, (
unsigned int)width);
419 BGRToGrey((
unsigned char *)src->imageData, dest.
bitmap, (
unsigned int)width, (
unsigned int)height,
false);
422 if (nChannel == 1 && depth == 8) {
423 dest.
resize((
unsigned int)height, (
unsigned int)width);
424 for (
int i = 0; i < height; i++) {
425 memcpy(dest.
bitmap + i * width, src->imageData + i * widthStep, (
size_t)width);
428 if (nChannel == 3 && depth == 8) {
429 dest.
resize((
unsigned int)height, (
unsigned int)width);
430 for (
int i = 0; i < height; i++) {
431 BGRToGrey((
unsigned char *)src->imageData + i * widthStep, dest.
bitmap + i * width, (
unsigned int)width, 1,
437 if (nChannel == 1 && depth == 8) {
438 dest.
resize((
unsigned int)height, (
unsigned int)width);
439 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
440 for (
int i = 0; i < height; i++) {
441 memcpy(beginOutput + lineStep * (4 * width * (height - 1 - i)), src->imageData + i * widthStep, (
size_t)width);
444 if (nChannel == 3 && depth == 8) {
445 dest.
resize((
unsigned int)height, (
unsigned int)width);
447 BGRToGrey((
unsigned char *)src->imageData , dest.
bitmap , (
unsigned int)width,
448 (
unsigned int)height ,
true);
501 CvSize size = cvSize(width, height);
505 if (dest->nChannels != channels || dest->depth != depth || dest->height != height || dest->width != width) {
506 if (dest->nChannels != 0)
507 cvReleaseImage(&dest);
508 dest = cvCreateImage(size, depth, channels);
511 dest = cvCreateImage(size, depth, channels);
514 unsigned char *input = (
unsigned char *)src.
bitmap;
515 unsigned char *output = (
unsigned char *)dest->imageData;
519 int widthStep = dest->widthStep;
521 for (i = 0; i < height; i++) {
522 output = (
unsigned char *)dest->imageData + i * widthStep;
523 unsigned char *line = input;
524 for (j = 0; j < width; j++) {
525 *output++ = *(line + 2);
526 *output++ = *(line + 1);
582 unsigned int width = src.
getWidth();
583 CvSize size = cvSize((
int)width, (
int)height);
587 if (dest->nChannels != channels || dest->depth != depth || dest->height != (
int)height ||
588 dest->width != (
int)width) {
589 if (dest->nChannels != 0)
590 cvReleaseImage(&dest);
591 dest = cvCreateImage(size, depth, channels);
594 dest = cvCreateImage(size, depth, channels);
596 unsigned int widthStep = (
unsigned int)dest->widthStep;
598 if (width == widthStep) {
599 memcpy(dest->imageData, src.
bitmap, width * height);
602 for (
unsigned int i = 0; i < height; i++) {
603 memcpy(dest->imageData + i * widthStep, src.
bitmap + i * width, width);
608 #if VISP_HAVE_OPENCV_VERSION >= 0x020100 658 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
660 if (src.type() == CV_8UC4) {
662 for (
unsigned int i = 0; i < dest.
getRows(); ++i)
663 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
664 cv::Vec4b tmp = src.at<cv::Vec4b>((int)i, (
int)j);
670 dest[dest.
getRows() - i - 1][j] = rgbaVal;
672 dest[i][j] = rgbaVal;
674 }
else if (src.type() == CV_8UC3) {
675 if (src.isContinuous() && !flip) {
676 SimdBgrToRgba(src.data, src.cols, src.rows, src.step[0], reinterpret_cast<uint8_t*>(dest.
bitmap),
681 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
682 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
683 cv::Vec3b tmp = src.at<cv::Vec3b>((int)i, (
int)j);
688 dest[dest.
getRows() - i - 1][j] = rgbaVal;
690 dest[i][j] = rgbaVal;
695 }
else if (src.type() == CV_8UC1) {
696 if (src.isContinuous() && !flip) {
697 SimdGrayToBgra(src.data, src.cols, src.rows, src.step[0], reinterpret_cast<uint8_t*>(dest.
bitmap),
701 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
702 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
703 rgbaVal = src.at<
unsigned char>((int)i, (
int)j);
705 dest[dest.
getRows() - i - 1][j] = rgbaVal;
707 dest[i][j] = rgbaVal;
758 unsigned int nThreads)
760 if (src.type() == CV_8UC1) {
761 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
762 if (src.isContinuous() && !flip) {
763 memcpy(dest.
bitmap, src.data, (
size_t)(src.rows * src.cols));
766 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
767 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + (dest.
getRows() - i - 1) * src.step1(), (size_t)src.step);
770 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
771 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + i * src.step1(), (size_t)src.step);
775 }
else if (src.type() == CV_8UC3) {
776 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
777 if (src.isContinuous()) {
778 BGRToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols, (
unsigned int)src.rows,
782 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
783 BGRToGrey((
unsigned char *)src.data + i * src.step1(),
785 (
unsigned int)dest.
getCols(), 1,
false);
788 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
790 (
unsigned int)dest.
getCols(), 1,
false);
795 else if (src.type() == CV_8UC4) {
796 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
797 if (src.isContinuous()) {
798 BGRaToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols, (
unsigned int)src.rows,
802 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
803 BGRaToGrey((
unsigned char *)src.data + i * src.step1(),
805 (
unsigned int)dest.
getCols(), 1,
false);
808 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
810 (
unsigned int)dest.
getCols(), 1,
false);
856 cv::cvtColor(vpToMat, dest, cv::COLOR_RGBA2BGR);
901 dest = tmpMap.clone();
910 #ifdef VISP_HAVE_YARP 996 dest.
resize(src->height(), src->width());
998 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelMono));
1000 dest.
bitmap = src->getRawImage();
1088 dest.
resize(src->height(), src->width());
1090 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelRgba));
1092 dest.
bitmap =
static_cast<vpRGBa *
>(src->getRawImage());
1130 for (
unsigned int i = 0; i < src.
getRows(); i++) {
1131 for (
unsigned int j = 0; j < src.
getWidth(); j++) {
1132 dest->pixel(j, i).r = src[i][j].R;
1133 dest->pixel(j, i).g = src[i][j].G;
1134 dest->pixel(j, i).b = src[i][j].B;
1179 dest.
resize(src->height(), src->width());
1180 for (
int i = 0; i < src->height(); i++) {
1181 for (
int j = 0; j < src->width(); j++) {
1182 dest[i][j].R = src->pixel(j, i).r;
1183 dest[i][j].G = src->pixel(j, i).g;
1184 dest[i][j].B = src->pixel(j, i).b;
1212 int r, g, b, cr, cg, cb, y1, y2;
1222 cb = ((*s - 128) * 454) >> 8;
1223 cg = (*s++ - 128) * 88;
1225 cr = ((*s - 128) * 359) >> 8;
1226 cg = (cg + (*s++ - 128) * 183) >> 8;
1235 *d++ =
static_cast<unsigned char>(r);
1236 *d++ =
static_cast<unsigned char>(g);
1237 *d++ =
static_cast<unsigned char>(b);
1247 *d++ =
static_cast<unsigned char>(r);
1248 *d++ =
static_cast<unsigned char>(g);
1249 *d++ =
static_cast<unsigned char>(b);
1266 int r, g, b, cr, cg, cb, y1, y2;
1276 cb = ((*s - 128) * 454) >> 8;
1277 cg = (*s++ - 128) * 88;
1279 cr = ((*s - 128) * 359) >> 8;
1280 cg = (cg + (*s++ - 128) * 183) >> 8;
1289 *d++ =
static_cast<unsigned char>(r);
1290 *d++ =
static_cast<unsigned char>(g);
1291 *d++ =
static_cast<unsigned char>(b);
1300 *d++ =
static_cast<unsigned char>(r);
1301 *d++ =
static_cast<unsigned char>(g);
1302 *d++ =
static_cast<unsigned char>(b);
1315 unsigned int i = 0, j = 0;
1317 while (j < size * 2) {
1318 grey[i++] = yuyv[j];
1319 grey[i++] = yuyv[j + 2];
1332 for (
unsigned int i = size / 4; i; i--) {
1333 int U = (int)((*yuv++ - 128) * 0.354);
1337 int V = (int)((*yuv++ - 128) * 0.707);
1365 *rgba++ = (
unsigned char)R;
1366 *rgba++ = (
unsigned char)G;
1367 *rgba++ = (
unsigned char)B;
1389 *rgba++ = (
unsigned char)R;
1390 *rgba++ = (
unsigned char)G;
1391 *rgba++ = (
unsigned char)B;
1413 *rgba++ = (
unsigned char)R;
1414 *rgba++ = (
unsigned char)G;
1415 *rgba++ = (
unsigned char)B;
1437 *rgba++ = (
unsigned char)R;
1438 *rgba++ = (
unsigned char)G;
1439 *rgba++ = (
unsigned char)B;
1444 unsigned int i = 0, j = 0;
1445 unsigned char r, g, b;
1446 while (j < numpixels * 3 / 2) {
1448 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1455 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1462 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1469 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1494 for (
unsigned int i = size / 2; i; i--) {
1495 int U = (int)((*yuv++ - 128) * 0.354);
1498 int V = (int)((*yuv++ - 128) * 0.707);
1522 *rgba++ = (
unsigned char)R;
1523 *rgba++ = (
unsigned char)G;
1524 *rgba++ = (
unsigned char)B;
1546 *rgba++ = (
unsigned char)R;
1547 *rgba++ = (
unsigned char)G;
1548 *rgba++ = (
unsigned char)B;
1554 unsigned int i = 0, j = 0;
1555 unsigned char r, g, b;
1557 while (j < size * 2) {
1559 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1566 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1583 unsigned int i = 0, j = 0;
1584 while (j < size * 3 / 2) {
1585 grey[i] = yuv[j + 1];
1586 grey[i + 1] = yuv[j + 2];
1587 grey[i + 2] = yuv[j + 4];
1588 grey[i + 3] = yuv[j + 5];
1606 for (
unsigned int i = size / 2; i; i--) {
1607 int U = (int)((*yuv++ - 128) * 0.354);
1610 int V = (int)((*yuv++ - 128) * 0.707);
1634 *rgb++ = (
unsigned char)R;
1635 *rgb++ = (
unsigned char)G;
1636 *rgb++ = (
unsigned char)B;
1657 *rgb++ = (
unsigned char)R;
1658 *rgb++ = (
unsigned char)G;
1659 *rgb++ = (
unsigned char)B;
1664 unsigned int i = 0, j = 0;
1665 unsigned char r, g, b;
1667 while (j < size * 2) {
1669 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1675 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1693 unsigned int i = 0, j = 0;
1695 while (j < size * 2) {
1696 grey[i++] = yuv[j + 1];
1697 grey[i++] = yuv[j + 3];
1710 for (
unsigned int i = size / 4; i; i--) {
1711 int U = (int)((*yuv++ - 128) * 0.354);
1715 int V = (int)((*yuv++ - 128) * 0.707);
1743 *rgb++ = (
unsigned char)R;
1744 *rgb++ = (
unsigned char)G;
1745 *rgb++ = (
unsigned char)B;
1766 *rgb++ = (
unsigned char)R;
1767 *rgb++ = (
unsigned char)G;
1768 *rgb++ = (
unsigned char)B;
1789 *rgb++ = (
unsigned char)R;
1790 *rgb++ = (
unsigned char)G;
1791 *rgb++ = (
unsigned char)B;
1812 *rgb++ = (
unsigned char)R;
1813 *rgb++ = (
unsigned char)G;
1814 *rgb++ = (
unsigned char)B;
1819 unsigned int i = 0, j = 0;
1820 unsigned char r, g, b;
1822 while (j < size * 3 / 2) {
1823 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1829 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1835 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1841 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1861 int U, V, R, G, B, V2, U5, UV;
1863 unsigned int size = width * height;
1864 unsigned char *iU = yuv + size;
1865 unsigned char *iV = yuv + 5 * size / 4;
1866 for (
unsigned int i = 0; i < height / 2; i++) {
1867 for (
unsigned int j = 0; j < width / 2; j++) {
1868 U = (int)((*iU++ - 128) * 0.354);
1870 V = (int)((*iV++ - 128) * 0.707);
1875 yuv = yuv + width - 1;
1878 yuv = yuv - width + 1;
1902 *rgba++ = (
unsigned char)R;
1903 *rgba++ = (
unsigned char)G;
1904 *rgba++ = (
unsigned char)B;
1926 *rgba++ = (
unsigned char)R;
1927 *rgba++ = (
unsigned char)G;
1928 *rgba++ = (
unsigned char)B;
1930 rgba = rgba + 4 * width - 7;
1951 *rgba++ = (
unsigned char)R;
1952 *rgba++ = (
unsigned char)G;
1953 *rgba++ = (
unsigned char)B;
1975 *rgba++ = (
unsigned char)R;
1976 *rgba++ = (
unsigned char)G;
1977 *rgba++ = (
unsigned char)B;
1979 rgba = rgba - 4 * width + 1;
1992 int U, V, R, G, B, V2, U5, UV;
1994 unsigned int size = width * height;
1995 unsigned char *iU = yuv + size;
1996 unsigned char *iV = yuv + 5 * size / 4;
1997 for (
unsigned int i = 0; i < height / 2; i++) {
1998 for (
unsigned int j = 0; j < width / 2; j++) {
1999 U = (int)((*iU++ - 128) * 0.354);
2001 V = (int)((*iV++ - 128) * 0.707);
2006 yuv = yuv + width - 1;
2009 yuv = yuv - width + 1;
2033 *rgb++ = (
unsigned char)R;
2034 *rgb++ = (
unsigned char)G;
2035 *rgb++ = (
unsigned char)B;
2056 *rgb++ = (
unsigned char)R;
2057 *rgb++ = (
unsigned char)G;
2058 *rgb = (
unsigned char)B;
2059 rgb = rgb + 3 * width - 5;
2080 *rgb++ = (
unsigned char)R;
2081 *rgb++ = (
unsigned char)G;
2082 *rgb++ = (
unsigned char)B;
2103 *rgb++ = (
unsigned char)R;
2104 *rgb++ = (
unsigned char)G;
2105 *rgb = (
unsigned char)B;
2106 rgb = rgb - 3 * width + 1;
2118 for (
unsigned int i = 0; i < size; i++) {
2130 for (
unsigned int i = 0; i < size; i++) {
2131 int U = (int)((*yuv++ - 128) * 0.354);
2134 int V = (int)((*yuv++ - 128) * 0.707);
2160 *rgba++ = (
unsigned char)R;
2161 *rgba++ = (
unsigned char)G;
2162 *rgba++ = (
unsigned char)B;
2172 for (
unsigned int i = 0; i < size; i++) {
2173 int U = (int)((*yuv++ - 128) * 0.354);
2176 int V = (int)((*yuv++ - 128) * 0.707);
2202 *rgb++ = (
unsigned char)R;
2203 *rgb++ = (
unsigned char)G;
2204 *rgb++ = (
unsigned char)B;
2214 for (
unsigned int i = 0; i < size; i++) {
2228 int U, V, R, G, B, V2, U5, UV;
2230 unsigned int size = width * height;
2231 unsigned char *iV = yuv + size;
2232 unsigned char *iU = yuv + 5 * size / 4;
2233 for (
unsigned int i = 0; i < height / 2; i++) {
2234 for (
unsigned int j = 0; j < width / 2; j++) {
2235 U = (int)((*iU++ - 128) * 0.354);
2237 V = (int)((*iV++ - 128) * 0.707);
2242 yuv = yuv + width - 1;
2245 yuv = yuv - width + 1;
2269 *rgba++ = (
unsigned char)R;
2270 *rgba++ = (
unsigned char)G;
2271 *rgba++ = (
unsigned char)B;
2293 *rgba++ = (
unsigned char)R;
2294 *rgba++ = (
unsigned char)G;
2295 *rgba++ = (
unsigned char)B;
2297 rgba = rgba + 4 * width - 7;
2318 *rgba++ = (
unsigned char)R;
2319 *rgba++ = (
unsigned char)G;
2320 *rgba++ = (
unsigned char)B;
2342 *rgba++ = (
unsigned char)R;
2343 *rgba++ = (
unsigned char)G;
2344 *rgba++ = (
unsigned char)B;
2346 rgba = rgba - 4 * width + 1;
2359 int U, V, R, G, B, V2, U5, UV;
2361 unsigned int size = width * height;
2362 unsigned char *iV = yuv + size;
2363 unsigned char *iU = yuv + 5 * size / 4;
2364 for (
unsigned int i = 0; i < height / 2; i++) {
2365 for (
unsigned int j = 0; j < width / 2; j++) {
2366 U = (int)((*iU++ - 128) * 0.354);
2368 V = (int)((*iV++ - 128) * 0.707);
2373 yuv = yuv + width - 1;
2376 yuv = yuv - width + 1;
2400 *rgb++ = (
unsigned char)R;
2401 *rgb++ = (
unsigned char)G;
2402 *rgb++ = (
unsigned char)B;
2423 *rgb++ = (
unsigned char)R;
2424 *rgb++ = (
unsigned char)G;
2425 *rgb = (
unsigned char)B;
2426 rgb = rgb + 3 * width - 5;
2447 *rgb++ = (
unsigned char)R;
2448 *rgb++ = (
unsigned char)G;
2449 *rgb++ = (
unsigned char)B;
2470 *rgb++ = (
unsigned char)R;
2471 *rgb++ = (
unsigned char)G;
2472 *rgb = (
unsigned char)B;
2473 rgb = rgb - 3 * width + 1;
2488 int U, V, R, G, B, V2, U5, UV;
2489 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2490 unsigned int size = width * height;
2491 unsigned char *iV = yuv + size;
2492 unsigned char *iU = yuv + 17 * size / 16;
2493 for (
unsigned int i = 0; i < height / 4; i++) {
2494 for (
unsigned int j = 0; j < width / 4; j++) {
2495 U = (int)((*iU++ - 128) * 0.354);
2497 V = (int)((*iV++ - 128) * 0.707);
2504 yuv = yuv + width - 3;
2509 yuv = yuv + width - 3;
2514 yuv = yuv + width - 3;
2519 yuv = yuv - 3 * width + 1;
2543 *rgba++ = (
unsigned char)R;
2544 *rgba++ = (
unsigned char)G;
2545 *rgba++ = (
unsigned char)B;
2567 *rgba++ = (
unsigned char)R;
2568 *rgba++ = (
unsigned char)G;
2569 *rgba++ = (
unsigned char)B;
2591 *rgba++ = (
unsigned char)R;
2592 *rgba++ = (
unsigned char)G;
2593 *rgba++ = (
unsigned char)B;
2615 *rgba++ = (
unsigned char)R;
2616 *rgba++ = (
unsigned char)G;
2617 *rgba++ = (
unsigned char)B;
2619 rgba = rgba + 4 * width - 15;
2639 *rgba++ = (
unsigned char)R;
2640 *rgba++ = (
unsigned char)G;
2641 *rgba++ = (
unsigned char)B;
2663 *rgba++ = (
unsigned char)R;
2664 *rgba++ = (
unsigned char)G;
2665 *rgba++ = (
unsigned char)B;
2687 *rgba++ = (
unsigned char)R;
2688 *rgba++ = (
unsigned char)G;
2689 *rgba++ = (
unsigned char)B;
2711 *rgba++ = (
unsigned char)R;
2712 *rgba++ = (
unsigned char)G;
2713 *rgba++ = (
unsigned char)B;
2715 rgba = rgba + 4 * width - 15;
2735 *rgba++ = (
unsigned char)R;
2736 *rgba++ = (
unsigned char)G;
2737 *rgba++ = (
unsigned char)B;
2759 *rgba++ = (
unsigned char)R;
2760 *rgba++ = (
unsigned char)G;
2761 *rgba++ = (
unsigned char)B;
2783 *rgba++ = (
unsigned char)R;
2784 *rgba++ = (
unsigned char)G;
2785 *rgba++ = (
unsigned char)B;
2807 *rgba++ = (
unsigned char)R;
2808 *rgba++ = (
unsigned char)G;
2809 *rgba++ = (
unsigned char)B;
2811 rgba = rgba + 4 * width - 15;
2831 *rgba++ = (
unsigned char)R;
2832 *rgba++ = (
unsigned char)G;
2833 *rgba++ = (
unsigned char)B;
2855 *rgba++ = (
unsigned char)R;
2856 *rgba++ = (
unsigned char)G;
2857 *rgba++ = (
unsigned char)B;
2879 *rgba++ = (
unsigned char)R;
2880 *rgba++ = (
unsigned char)G;
2881 *rgba++ = (
unsigned char)B;
2903 *rgba++ = (
unsigned char)R;
2904 *rgba++ = (
unsigned char)G;
2905 *rgba++ = (
unsigned char)B;
2907 rgba = rgba - 12 * width + 1;
2920 int U, V, R, G, B, V2, U5, UV;
2921 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2922 unsigned int size = width * height;
2923 unsigned char *iV = yuv + size;
2924 unsigned char *iU = yuv + 17 * size / 16;
2925 for (
unsigned int i = 0; i < height / 4; i++) {
2926 for (
unsigned int j = 0; j < width / 4; j++) {
2927 U = (int)((*iU++ - 128) * 0.354);
2929 V = (int)((*iV++ - 128) * 0.707);
2936 yuv = yuv + width - 3;
2941 yuv = yuv + width - 3;
2946 yuv = yuv + width - 3;
2951 yuv = yuv - 3 * width + 1;
2975 *rgb++ = (
unsigned char)R;
2976 *rgb++ = (
unsigned char)G;
2977 *rgb++ = (
unsigned char)B;
2998 *rgb++ = (
unsigned char)R;
2999 *rgb++ = (
unsigned char)G;
3000 *rgb++ = (
unsigned char)B;
3021 *rgb++ = (
unsigned char)R;
3022 *rgb++ = (
unsigned char)G;
3023 *rgb++ = (
unsigned char)B;
3044 *rgb++ = (
unsigned char)R;
3045 *rgb++ = (
unsigned char)G;
3046 *rgb = (
unsigned char)B;
3047 rgb = rgb + 3 * width - 11;
3067 *rgb++ = (
unsigned char)R;
3068 *rgb++ = (
unsigned char)G;
3069 *rgb++ = (
unsigned char)B;
3090 *rgb++ = (
unsigned char)R;
3091 *rgb++ = (
unsigned char)G;
3092 *rgb++ = (
unsigned char)B;
3113 *rgb++ = (
unsigned char)R;
3114 *rgb++ = (
unsigned char)G;
3115 *rgb++ = (
unsigned char)B;
3136 *rgb++ = (
unsigned char)R;
3137 *rgb++ = (
unsigned char)G;
3138 *rgb = (
unsigned char)B;
3139 rgb = rgb + 3 * width - 11;
3159 *rgb++ = (
unsigned char)R;
3160 *rgb++ = (
unsigned char)G;
3161 *rgb++ = (
unsigned char)B;
3182 *rgb++ = (
unsigned char)R;
3183 *rgb++ = (
unsigned char)G;
3184 *rgb++ = (
unsigned char)B;
3205 *rgb++ = (
unsigned char)R;
3206 *rgb++ = (
unsigned char)G;
3207 *rgb++ = (
unsigned char)B;
3228 *rgb++ = (
unsigned char)R;
3229 *rgb++ = (
unsigned char)G;
3230 *rgb = (
unsigned char)B;
3231 rgb = rgb + 3 * width - 11;
3251 *rgb++ = (
unsigned char)R;
3252 *rgb++ = (
unsigned char)G;
3253 *rgb++ = (
unsigned char)B;
3274 *rgb++ = (
unsigned char)R;
3275 *rgb++ = (
unsigned char)G;
3276 *rgb++ = (
unsigned char)B;
3297 *rgb++ = (
unsigned char)R;
3298 *rgb++ = (
unsigned char)G;
3299 *rgb++ = (
unsigned char)B;
3320 *rgb++ = (
unsigned char)R;
3321 *rgb++ = (
unsigned char)G;
3322 *rgb++ = (
unsigned char)B;
3323 rgb = rgb - 9 * width + 1;
3357 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3360 unsigned char *src = (flip) ? (rgb + (width * height * 3) + lineStep) : rgb;
3365 for (i = 0; i < height; i++) {
3366 unsigned char *line = src;
3367 for (j = 0; j < width; j++) {
3368 *rgba++ = *(line++);
3369 *rgba++ = *(line++);
3370 *rgba++ = *(line++);
3388 SimdBgraToBgr(rgba, size, 1, size * 4, rgb, size * 3);
3412 SimdRgbToGray(rgb, width, height, width * 3, grey, width);
3416 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3419 unsigned char *src = (flip) ? rgb + (width * height * 3) + lineStep : rgb;
3426 for (i = 0; i < height; i++) {
3427 unsigned char *line = src;
3428 for (j = 0; j < width; j++) {
3432 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
3456 omp_set_num_threads(static_cast<int>(nThreads));
3458 #pragma omp parallel for 3460 for (
int i = 0; i < static_cast<int>(height); i++) {
3461 SimdRgbaToGray(rgba + i*width*4, width, 1, width*4, grey + i*width, width);
3474 SimdRgbaToGray(rgba, size, 1, size*4, grey, size);
3506 SimdGrayToBgr(grey, size, 1, size, rgb, size * 3);
3526 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3529 unsigned char *src = (flip) ? (bgr + (width * height * 3) + lineStep) : bgr;
3531 for (
unsigned int i = 0; i < height; i++) {
3532 unsigned char *line = src;
3533 for (
unsigned int j = 0; j < width; j++) {
3534 *rgba++ = *(line + 2);
3535 *rgba++ = *(line + 1);
3536 *rgba++ = *(line + 0);
3559 SimdBgraToRgba(bgra, width, height, width*4, rgba, width * 4);
3563 int lineStep = (flip) ? -(
int)(width * 4) : (
int)(width * 4);
3566 unsigned char *src = (flip) ? (bgra + (width * height * 4) + lineStep) : bgra;
3568 for (
unsigned int i = 0; i < height; i++) {
3569 unsigned char *line = src;
3570 for (
unsigned int j = 0; j < width; j++) {
3571 *rgba++ = *(line + 2);
3572 *rgba++ = *(line + 1);
3573 *rgba++ = *(line + 0);
3574 *rgba++ = *(line + 3);
3592 bool flip,
unsigned int 3601 omp_set_num_threads(static_cast<int>(nThreads));
3603 #pragma omp parallel for 3605 for (
int i = 0; i < static_cast<int>(height); i++) {
3606 SimdBgrToGray(bgr + i*width*3, width, 1, width * 3, grey + i*width, width);
3611 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3614 unsigned char *src = (flip) ? bgr + (width * height * 3) + lineStep : bgr;
3616 for (
unsigned int i = 0; i < height; i++) {
3617 unsigned char *line = src;
3618 for (
unsigned int j = 0; j < width; j++) {
3619 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3637 bool flip,
unsigned int 3646 omp_set_num_threads(static_cast<int>(nThreads));
3648 #pragma omp parallel for 3650 for (
int i = 0; i < static_cast<int>(height); i++) {
3651 SimdBgraToGray(bgra + i*width*4, width, 1, width * 4, grey + i*width, width);
3656 int lineStep = (flip) ? -(
int)(width * 4) : (
int)(width * 4);
3659 unsigned char *src = (flip) ? bgra + (width * height * 4) + lineStep : bgra;
3661 for (
unsigned int i = 0; i < height; i++) {
3662 unsigned char *line = src;
3663 for (
unsigned int j = 0; j < width; j++) {
3664 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3677 void vpImageConvert::computeYCbCrLUT()
3679 if (YCbCrLUTcomputed ==
false) {
3684 int aux = index - 128;
3685 vpImageConvert::vpCrr[index] = (int)(364.6610 * aux) >> 8;
3686 vpImageConvert::vpCgb[index] = (int)(-89.8779 * aux) >> 8;
3687 vpImageConvert::vpCgr[index] = (int)(-185.8154 * aux) >> 8;
3688 vpImageConvert::vpCbb[index] = (int)(460.5724 * aux) >> 8;
3691 YCbCrLUTcomputed =
true;
3715 unsigned char *pt_ycbcr = ycbcr;
3716 unsigned char *pt_rgb = rgb;
3720 vpImageConvert::computeYCbCrLUT();
3725 int val_r, val_g, val_b;
3731 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3732 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3733 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3735 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3737 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3738 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3739 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3769 unsigned char *pt_ycbcr = ycbcr;
3770 unsigned char *pt_rgba = rgba;
3774 vpImageConvert::computeYCbCrLUT();
3779 int val_r, val_g, val_b;
3785 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3786 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3787 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3789 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3791 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3792 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3793 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3816 unsigned int i = 0, j = 0;
3818 while (j < size * 2) {
3820 grey[i++] = yuv[j + 2];
3845 unsigned char *pt_ycbcr = ycrcb;
3846 unsigned char *pt_rgb = rgb;
3850 vpImageConvert::computeYCbCrLUT();
3855 int val_r, val_g, val_b;
3861 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3862 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3863 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3865 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3867 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3868 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3869 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3898 unsigned char *pt_ycbcr = ycrcb;
3899 unsigned char *pt_rgba = rgba;
3903 vpImageConvert::computeYCbCrLUT();
3908 int val_r, val_g, val_b;
3914 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3915 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3916 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3918 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3920 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3921 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3922 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3982 unsigned char *ptrR = pR ? pR->
bitmap :
new unsigned char[src.
getSize()];
3983 unsigned char *ptrG = pG ? pG->
bitmap :
new unsigned char[src.
getSize()];
3984 unsigned char *ptrB = pB ? pB->
bitmap :
new unsigned char[src.
getSize()];
3985 unsigned char *ptrA = pa ? pa->
bitmap :
new unsigned char[src.
getSize()];
3987 SimdDeinterleaveBgra(reinterpret_cast<unsigned char*>(src.
bitmap), src.
getWidth()*
sizeof(
vpRGBa),
4023 std::map<unsigned int, unsigned int> mapOfWidths, mapOfHeights;
4044 if (mapOfWidths.size() == 1 && mapOfHeights.size() == 1) {
4045 unsigned int width = mapOfWidths.begin()->first;
4046 unsigned int height = mapOfHeights.begin()->first;
4048 RGBa.
resize(height, width);
4050 if (R != NULL && G != NULL && B != NULL && a != NULL) {
4052 a->
bitmap, width, width, height, reinterpret_cast<uint8_t *>(RGBa.
bitmap),
4055 unsigned int size = width * height;
4056 for (
unsigned int i = 0; i < size; i++) {
4089 int i = (((int)size) << 1) - 1;
4090 int j = (int)size - 1;
4093 int y = grey16[i--];
4094 grey[j--] =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4110 int i = (((int)size) << 1) - 1;
4111 int j = (int)(size * 4 - 1);
4114 int y = grey16[i--];
4115 unsigned char v =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4123 void vpImageConvert::HSV2RGB(
const double *hue_,
const double *saturation_,
const double *value_,
unsigned char *rgb,
4124 unsigned int size,
unsigned int step)
4126 for (
unsigned int i = 0; i < size; i++) {
4127 double hue = hue_[i], saturation = saturation_[i], value = value_[i];
4129 if (
vpMath::equal(saturation, 0.0, std::numeric_limits<double>::epsilon())) {
4133 double h = hue * 6.0;
4134 double s = saturation;
4137 if (
vpMath::equal(h, 6.0, std::numeric_limits<double>::epsilon())) {
4141 double f = h - (int)h;
4142 double p = v * (1.0 - s);
4143 double q = v * (1.0 - s * f);
4144 double t = v * (1.0 - s * (1.0 - f));
4186 rgb[i * step + 1] = (
unsigned char)
vpMath::round(saturation * 255.0);
4187 rgb[i * step + 2] = (
unsigned char)
vpMath::round(value * 255.0);
4193 void vpImageConvert::RGB2HSV(
const unsigned char *rgb,
double *hue,
double *saturation,
double *value,
4194 unsigned int size,
unsigned int step)
4196 for (
unsigned int i = 0; i < size; i++) {
4197 double red, green, blue;
4201 red = rgb[i * step] / 255.0;
4202 green = rgb[i * step + 1] / 255.0;
4203 blue = rgb[i * step + 2] / 255.0;
4206 max = ((std::max))(red, blue);
4207 min = ((std::min))(green, blue);
4209 max = ((std::max))(green, blue);
4210 min = ((std::min))(red, blue);
4215 if (!
vpMath::equal(max, 0.0, std::numeric_limits<double>::epsilon())) {
4216 s = (max - min) / max;
4221 if (
vpMath::equal(s, 0.0, std::numeric_limits<double>::epsilon())) {
4224 double delta = max - min;
4225 if (
vpMath::equal(delta, 0.0, std::numeric_limits<double>::epsilon())) {
4229 if (
vpMath::equal(red, max, std::numeric_limits<double>::epsilon())) {
4230 h = (green - blue) / delta;
4231 }
else if (
vpMath::equal(green, max, std::numeric_limits<double>::epsilon())) {
4232 h = 2 + (blue - red) / delta;
4234 h = 4 + (red - green) / delta;
4240 }
else if (h > 1.0) {
4266 vpImageConvert::HSV2RGB(hue, saturation, value, rgba, size, 4);
4282 unsigned char *rgba,
unsigned int size)
4284 for (
unsigned int i = 0; i < size; i++) {
4285 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4306 vpImageConvert::RGB2HSV(rgba, hue, saturation, value, size, 4);
4321 unsigned char *value,
unsigned int size)
4323 for (
unsigned int i = 0; i < size; i++) {
4327 hue[i] = (
unsigned char)(255.0 * h);
4328 saturation[i] = (
unsigned char)(255.0 * s);
4329 value[i] = (
unsigned char)(255.0 * v);
4345 vpImageConvert::HSV2RGB(hue, saturation, value, rgb, size, 3);
4358 unsigned char *rgb,
unsigned int size)
4360 for (
unsigned int i = 0; i < size; i++) {
4361 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4381 vpImageConvert::RGB2HSV(rgb, hue, saturation, value, size, 3);
4395 unsigned char *value,
unsigned int size)
4397 for (
unsigned int i = 0; i < size; i++) {
4402 hue[i] = (
unsigned char)(255.0 * h);
4403 saturation[i] = (
unsigned char)(255.0 * s);
4404 value[i] = (
unsigned char)(255.0 * v);
unsigned int getCols() const
static void BGRToRGBa(unsigned char *bgr, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
static void YUYVToRGBa(unsigned char *yuyv, unsigned char *rgba, unsigned int width, unsigned int height)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
static void HSVToRGB(const double *hue, const double *saturation, const double *value, unsigned char *rgb, unsigned int size)
void getMinMaxValue(Type &min, Type &max) const
Look for the minimum and the maximum value within the bitmap.
unsigned char B
Blue component.
static void RGBToRGBa(unsigned char *rgb, unsigned char *rgba, unsigned int size)
static void RGBaToHSV(const unsigned char *rgba, double *hue, double *saturation, double *value, unsigned int size)
Type * bitmap
points toward the bitmap
static void MONO16ToGrey(unsigned char *grey16, unsigned char *grey, unsigned int size)
static bool equal(double x, double y, double s=0.001)
static void YUV422ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void BGRaToRGBa(unsigned char *bgra, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
static void YUV420ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
error that can be emited by ViSP classes.
static void YUV422ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YCbCrToRGB(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void YUV411ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void split(const vpImage< vpRGBa > &src, vpImage< unsigned char > *pR, vpImage< unsigned char > *pG, vpImage< unsigned char > *pB, vpImage< unsigned char > *pa=NULL)
static void YUVToRGB(unsigned char y, unsigned char u, unsigned char v, unsigned char &r, unsigned char &g, unsigned char &b)
unsigned char G
Green component.
static void GreyToRGB(unsigned char *grey, unsigned char *rgb, unsigned int size)
static void RGBToHSV(const unsigned char *rgb, double *hue, double *saturation, double *value, unsigned int size)
static void YUV444ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void GreyToRGBa(unsigned char *grey, unsigned char *rgba, unsigned int width, unsigned int height)
static void YUV420ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void YVU9ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void YUV422ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void RGBToGrey(unsigned char *rgb, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false)
unsigned int getRows() const
static void YVU9ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
static void YV12ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
unsigned int getSize() const
static void YCbCrToGrey(unsigned char *ycbcr, unsigned char *grey, unsigned int size)
unsigned char A
Additionnal component.
static void YUYVToGrey(unsigned char *yuyv, unsigned char *grey, unsigned int size)
static void MONO16ToRGBa(unsigned char *grey16, unsigned char *rgba, unsigned int size)
static void RGBaToGrey(unsigned char *rgba, unsigned char *grey, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void HSVToRGBa(const double *hue, const double *saturation, const double *value, unsigned char *rgba, unsigned int size)
static void merge(const vpImage< unsigned char > *R, const vpImage< unsigned char > *G, const vpImage< unsigned char > *B, const vpImage< unsigned char > *a, vpImage< vpRGBa > &RGBa)
static void BGRToGrey(unsigned char *bgr, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false, unsigned int nThreads=0)
static int round(double x)
static void YUYVToRGB(unsigned char *yuyv, unsigned char *rgb, unsigned int width, unsigned int height)
static void YUV444ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void BGRaToGrey(unsigned char *bgra, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false, unsigned int nThreads=0)
static void YUV444ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void YUV411ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
unsigned char R
Red component.
unsigned int getHeight() const
static void YCbCrToRGBa(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void YUV411ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void RGBaToRGB(unsigned char *rgba, unsigned char *rgb, unsigned int size)
static void YCrCbToRGB(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void YCrCbToRGBa(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void createDepthHistogram(const vpImage< uint16_t > &src_depth, vpImage< vpRGBa > &dest_rgba)
static void YV12ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
static void YUV420ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)