54 #include "private/vpBayerConversion.h"
55 #include "private/vpImageConvert_impl.h"
56 #include <Simd/SimdLib.hpp>
57 #include <visp3/core/vpImageConvert.h>
59 bool vpImageConvert::YCbCrLUTcomputed =
false;
60 int vpImageConvert::vpCrr[256];
61 int vpImageConvert::vpCgb[256];
62 int vpImageConvert::vpCgr[256];
63 int vpImageConvert::vpCbb[256];
110 for (
unsigned int i = 0; i < max_xy; i++) {
111 float val = 255.f * (src.
bitmap[i] - min) / (max - min);
117 dest.
bitmap[i] = (
unsigned char)val;
147 for (
unsigned int i = 0; i < max_xy; i++) {
148 double val = 255. * (src.
bitmap[i] - min) / (max - min);
154 dest.
bitmap[i] = (
unsigned char)val;
168 for (
unsigned int i = 0; i < src.
getSize(); i++)
169 dest.
bitmap[i] =
static_cast<unsigned char>(src.
bitmap[i] >> bitshift);
182 for (
unsigned int i = 0; i < src.
getSize(); i++)
183 dest.
bitmap[i] =
static_cast<unsigned char>(src.
bitmap[i] << bitshift);
207 vp_createDepthHistogram(src_depth, dest_rgba);
218 vp_createDepthHistogram(src_depth, dest_depth);
230 vp_createDepthHistogram(src_depth, dest_rgba);
241 vp_createDepthHistogram(src_depth, dest_depth);
244 #ifdef VISP_HAVE_OPENCV
293 int nChannel = src->nChannels;
294 int depth = src->depth;
295 int height = src->height;
296 int width = src->width;
297 int widthStep = src->widthStep;
298 int lineStep = (flip) ? 1 : 0;
300 if (nChannel == 3 && depth == 8) {
301 dest.
resize((
unsigned int)height, (
unsigned int)width);
304 unsigned char *input = (
unsigned char *)src->imageData;
305 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
307 for (
int i = 0; i < height; i++) {
308 unsigned char *line = input;
309 unsigned char *output = beginOutput + lineStep * (4 * width * (height - 1 - i)) + (1 - lineStep) * 4 * width * i;
310 for (
int j = 0; j < width; j++) {
311 *(output++) = *(line + 2);
312 *(output++) = *(line + 1);
313 *(output++) = *(line);
321 }
else if (nChannel == 1 && depth == 8) {
322 dest.
resize((
unsigned int)height, (
unsigned int)width);
324 unsigned char *input = (
unsigned char *)src->imageData;
325 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
327 for (
int i = 0; i < height; i++) {
328 unsigned char *line = input;
329 unsigned char *output = beginOutput + lineStep * (4 * width * (height - 1 - i)) + (1 - lineStep) * 4 * width * i;
330 for (
int j = 0; j < width; j++) {
388 int nChannel = src->nChannels;
389 int depth = src->depth;
390 int height = src->height;
391 int width = src->width;
392 int widthStep = src->widthStep;
393 int lineStep = (flip) ? 1 : 0;
396 if (widthStep == width) {
397 if (nChannel == 1 && depth == 8) {
398 dest.
resize((
unsigned int)height, (
unsigned int)width);
399 memcpy(dest.
bitmap, src->imageData, (
size_t)(height * width));
401 if (nChannel == 3 && depth == 8) {
402 dest.
resize((
unsigned int)height, (
unsigned int)width);
403 BGRToGrey((
unsigned char *)src->imageData, dest.
bitmap, (
unsigned int)width, (
unsigned int)height,
false);
406 if (nChannel == 1 && depth == 8) {
407 dest.
resize((
unsigned int)height, (
unsigned int)width);
408 for (
int i = 0; i < height; i++) {
409 memcpy(dest.
bitmap + i * width, src->imageData + i * widthStep, (
size_t)width);
412 if (nChannel == 3 && depth == 8) {
413 dest.
resize((
unsigned int)height, (
unsigned int)width);
414 for (
int i = 0; i < height; i++) {
415 BGRToGrey((
unsigned char *)src->imageData + i * widthStep, dest.
bitmap + i * width, (
unsigned int)width, 1,
421 if (nChannel == 1 && depth == 8) {
422 dest.
resize((
unsigned int)height, (
unsigned int)width);
423 unsigned char *beginOutput = (
unsigned char *)dest.
bitmap;
424 for (
int i = 0; i < height; i++) {
425 memcpy(beginOutput + lineStep * (4 * width * (height - 1 - i)), src->imageData + i * widthStep, (
size_t)width);
428 if (nChannel == 3 && depth == 8) {
429 dest.
resize((
unsigned int)height, (
unsigned int)width);
431 BGRToGrey((
unsigned char *)src->imageData , dest.
bitmap , (
unsigned int)width,
432 (
unsigned int)height ,
true);
485 CvSize size = cvSize(width, height);
489 if (dest->nChannels != channels || dest->depth != depth || dest->height != height || dest->width != width) {
490 if (dest->nChannels != 0)
491 cvReleaseImage(&dest);
492 dest = cvCreateImage(size, depth, channels);
495 dest = cvCreateImage(size, depth, channels);
498 unsigned char *input = (
unsigned char *)src.
bitmap;
499 unsigned char *output = (
unsigned char *)dest->imageData;
503 int widthStep = dest->widthStep;
505 for (i = 0; i < height; i++) {
506 output = (
unsigned char *)dest->imageData + i * widthStep;
507 unsigned char *line = input;
508 for (j = 0; j < width; j++) {
509 *output++ = *(line + 2);
510 *output++ = *(line + 1);
566 unsigned int width = src.
getWidth();
567 CvSize size = cvSize((
int)width, (
int)height);
571 if (dest->nChannels != channels || dest->depth != depth || dest->height != (
int)height ||
572 dest->width != (
int)width) {
573 if (dest->nChannels != 0)
574 cvReleaseImage(&dest);
575 dest = cvCreateImage(size, depth, channels);
578 dest = cvCreateImage(size, depth, channels);
580 unsigned int widthStep = (
unsigned int)dest->widthStep;
582 if (width == widthStep) {
583 memcpy(dest->imageData, src.
bitmap, width * height);
586 for (
unsigned int i = 0; i < height; i++) {
587 memcpy(dest->imageData + i * widthStep, src.
bitmap + i * width, width);
592 #if VISP_HAVE_OPENCV_VERSION >= 0x020100
642 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
644 if (src.type() == CV_8UC4) {
646 for (
unsigned int i = 0; i < dest.
getRows(); ++i)
647 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
648 cv::Vec4b tmp = src.at<cv::Vec4b>((int)i, (
int)j);
654 dest[dest.
getRows() - i - 1][j] = rgbaVal;
656 dest[i][j] = rgbaVal;
658 }
else if (src.type() == CV_8UC3) {
659 if (src.isContinuous() && !flip) {
660 SimdRgbToBgra(src.data, src.cols, src.rows, src.step[0],
reinterpret_cast<uint8_t *
>(dest.
bitmap),
665 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
666 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
667 cv::Vec3b tmp = src.at<cv::Vec3b>((int)i, (
int)j);
672 dest[dest.
getRows() - i - 1][j] = rgbaVal;
674 dest[i][j] = rgbaVal;
679 }
else if (src.type() == CV_8UC1) {
680 if (src.isContinuous() && !flip) {
681 SimdGrayToBgra(src.data, src.cols, src.rows, src.step[0],
reinterpret_cast<uint8_t *
>(dest.
bitmap),
685 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
686 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
687 rgbaVal = src.at<
unsigned char>((int)i, (
int)j);
689 dest[dest.
getRows() - i - 1][j] = rgbaVal;
691 dest[i][j] = rgbaVal;
743 if (src.type() == CV_8UC1) {
744 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
745 if (src.isContinuous() && !flip) {
746 memcpy(dest.
bitmap, src.data, (
size_t)(src.rows * src.cols));
749 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
750 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + (dest.
getRows() - i - 1) * src.step1(), (
size_t)src.step);
753 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
754 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + i * src.step1(), (
size_t)src.step);
758 }
else if (src.type() == CV_8UC3) {
759 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
760 if (src.isContinuous()) {
761 BGRToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols, (
unsigned int)src.rows,
765 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
766 BGRToGrey((
unsigned char *)src.data + i * src.step1(),
768 (
unsigned int)dest.
getCols(), 1,
false);
771 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
773 (
unsigned int)dest.
getCols(), 1,
false);
777 }
else if (src.type() == CV_8UC4) {
778 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
779 if (src.isContinuous()) {
780 BGRaToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols,
781 (
unsigned int)src.rows, flip, nThreads);
784 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
785 BGRaToGrey((
unsigned char *)src.data + i * src.step1(),
787 (
unsigned int)dest.
getCols(), 1,
false);
790 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
792 (
unsigned int)dest.
getCols(), 1,
false);
838 cv::cvtColor(vpToMat, dest, cv::COLOR_RGBA2BGR);
883 dest = tmpMap.clone();
892 #ifdef VISP_HAVE_YARP
977 dest.
resize(src->height(), src->width());
979 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelMono));
981 dest.
bitmap = src->getRawImage();
1067 dest.
resize(src->height(), src->width());
1069 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelRgba));
1071 dest.
bitmap =
static_cast<vpRGBa *
>(src->getRawImage());
1109 for (
unsigned int i = 0; i < src.
getRows(); i++) {
1110 for (
unsigned int j = 0; j < src.
getWidth(); j++) {
1111 dest->pixel(j, i).r = src[i][j].R;
1112 dest->pixel(j, i).g = src[i][j].G;
1113 dest->pixel(j, i).b = src[i][j].B;
1158 dest.
resize(src->height(), src->width());
1159 for (
int i = 0; i < src->height(); i++) {
1160 for (
int j = 0; j < src->width(); j++) {
1161 dest[i][j].R = src->pixel(j, i).r;
1162 dest[i][j].G = src->pixel(j, i).g;
1163 dest[i][j].B = src->pixel(j, i).b;
1195 int r, g, b, cr, cg, cb, y1, y2;
1205 cb = ((*s - 128) * 454) >> 8;
1206 cg = (*s++ - 128) * 88;
1208 cr = ((*s - 128) * 359) >> 8;
1209 cg = (cg + (*s++ - 128) * 183) >> 8;
1214 vpSAT(r) vpSAT(g) vpSAT(b)
1216 *d++ =
static_cast<unsigned char>(r);
1217 *d++ =
static_cast<unsigned char>(g);
1218 *d++ =
static_cast<unsigned char>(b);
1224 vpSAT(r) vpSAT(g) vpSAT(b)
1226 *d++ =
static_cast<unsigned char>(r);
1227 *d++ =
static_cast<unsigned char>(g);
1228 *d++ =
static_cast<unsigned char>(b);
1249 int r, g, b, cr, cg, cb, y1, y2;
1259 cb = ((*s - 128) * 454) >> 8;
1260 cg = (*s++ - 128) * 88;
1262 cr = ((*s - 128) * 359) >> 8;
1263 cg = (cg + (*s++ - 128) * 183) >> 8;
1268 vpSAT(r) vpSAT(g) vpSAT(b)
1270 *d++ =
static_cast<unsigned char>(r);
1271 *d++ =
static_cast<unsigned char>(g);
1272 *d++ =
static_cast<unsigned char>(b);
1277 vpSAT(r) vpSAT(g) vpSAT(b)
1279 *d++ =
static_cast<unsigned char>(r);
1280 *d++ =
static_cast<unsigned char>(g);
1281 *d++ =
static_cast<unsigned char>(b);
1298 unsigned int i = 0, j = 0;
1300 while (j < size * 2) {
1301 grey[i++] = yuyv[j];
1302 grey[i++] = yuyv[j + 2];
1320 for (
unsigned int i = size / 4; i; i--) {
1321 int U = (int)((*yuv++ - 128) * 0.354);
1325 int V = (int)((*yuv++ - 128) * 0.707);
1353 *rgba++ = (
unsigned char)R;
1354 *rgba++ = (
unsigned char)G;
1355 *rgba++ = (
unsigned char)B;
1377 *rgba++ = (
unsigned char)R;
1378 *rgba++ = (
unsigned char)G;
1379 *rgba++ = (
unsigned char)B;
1401 *rgba++ = (
unsigned char)R;
1402 *rgba++ = (
unsigned char)G;
1403 *rgba++ = (
unsigned char)B;
1425 *rgba++ = (
unsigned char)R;
1426 *rgba++ = (
unsigned char)G;
1427 *rgba++ = (
unsigned char)B;
1432 unsigned int i = 0, j = 0;
1433 unsigned char r, g, b;
1434 while (j < numpixels * 3 / 2) {
1436 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1443 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1450 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1457 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1486 for (
unsigned int i = size / 2; i; i--) {
1487 int U = (int)((*yuv++ - 128) * 0.354);
1490 int V = (int)((*yuv++ - 128) * 0.707);
1514 *rgba++ = (
unsigned char)R;
1515 *rgba++ = (
unsigned char)G;
1516 *rgba++ = (
unsigned char)B;
1538 *rgba++ = (
unsigned char)R;
1539 *rgba++ = (
unsigned char)G;
1540 *rgba++ = (
unsigned char)B;
1546 unsigned int i = 0, j = 0;
1547 unsigned char r, g, b;
1549 while (j < size * 2) {
1551 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1558 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1579 unsigned int i = 0, j = 0;
1580 while (j < size * 3 / 2) {
1581 grey[i] = yuv[j + 1];
1582 grey[i + 1] = yuv[j + 2];
1583 grey[i + 2] = yuv[j + 4];
1584 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);
1697 unsigned int i = 0, j = 0;
1699 while (j < size * 2) {
1700 grey[i++] = yuv[j + 1];
1701 grey[i++] = yuv[j + 3];
1718 for (
unsigned int i = size / 4; i; i--) {
1719 int U = (int)((*yuv++ - 128) * 0.354);
1723 int V = (int)((*yuv++ - 128) * 0.707);
1751 *rgb++ = (
unsigned char)R;
1752 *rgb++ = (
unsigned char)G;
1753 *rgb++ = (
unsigned char)B;
1774 *rgb++ = (
unsigned char)R;
1775 *rgb++ = (
unsigned char)G;
1776 *rgb++ = (
unsigned char)B;
1797 *rgb++ = (
unsigned char)R;
1798 *rgb++ = (
unsigned char)G;
1799 *rgb++ = (
unsigned char)B;
1820 *rgb++ = (
unsigned char)R;
1821 *rgb++ = (
unsigned char)G;
1822 *rgb++ = (
unsigned char)B;
1827 unsigned int i = 0, j = 0;
1828 unsigned char r, g, b;
1830 while (j < size * 3 / 2) {
1831 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1837 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1843 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1849 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1874 int U, V, R, G, B, V2, U5, UV;
1876 unsigned int size = width * height;
1877 unsigned char *iU = yuv + size;
1878 unsigned char *iV = yuv + 5 * size / 4;
1879 for (
unsigned int i = 0; i < height / 2; i++) {
1880 for (
unsigned int j = 0; j < width / 2; j++) {
1881 U = (int)((*iU++ - 128) * 0.354);
1883 V = (int)((*iV++ - 128) * 0.707);
1888 yuv = yuv + width - 1;
1891 yuv = yuv - width + 1;
1915 *rgba++ = (
unsigned char)R;
1916 *rgba++ = (
unsigned char)G;
1917 *rgba++ = (
unsigned char)B;
1939 *rgba++ = (
unsigned char)R;
1940 *rgba++ = (
unsigned char)G;
1941 *rgba++ = (
unsigned char)B;
1943 rgba = rgba + 4 * width - 7;
1964 *rgba++ = (
unsigned char)R;
1965 *rgba++ = (
unsigned char)G;
1966 *rgba++ = (
unsigned char)B;
1988 *rgba++ = (
unsigned char)R;
1989 *rgba++ = (
unsigned char)G;
1990 *rgba++ = (
unsigned char)B;
1992 rgba = rgba - 4 * width + 1;
2010 int U, V, R, G, B, V2, U5, UV;
2012 unsigned int size = width * height;
2013 unsigned char *iU = yuv + size;
2014 unsigned char *iV = yuv + 5 * size / 4;
2015 for (
unsigned int i = 0; i < height / 2; i++) {
2016 for (
unsigned int j = 0; j < width / 2; j++) {
2017 U = (int)((*iU++ - 128) * 0.354);
2019 V = (int)((*iV++ - 128) * 0.707);
2024 yuv = yuv + width - 1;
2027 yuv = yuv - width + 1;
2051 *rgb++ = (
unsigned char)R;
2052 *rgb++ = (
unsigned char)G;
2053 *rgb++ = (
unsigned char)B;
2074 *rgb++ = (
unsigned char)R;
2075 *rgb++ = (
unsigned char)G;
2076 *rgb = (
unsigned char)B;
2077 rgb = rgb + 3 * width - 5;
2098 *rgb++ = (
unsigned char)R;
2099 *rgb++ = (
unsigned char)G;
2100 *rgb++ = (
unsigned char)B;
2121 *rgb++ = (
unsigned char)R;
2122 *rgb++ = (
unsigned char)G;
2123 *rgb = (
unsigned char)B;
2124 rgb = rgb - 3 * width + 1;
2140 for (
unsigned int i = 0; i < size; i++) {
2156 for (
unsigned int i = 0; i < size; i++) {
2157 int U = (int)((*yuv++ - 128) * 0.354);
2160 int V = (int)((*yuv++ - 128) * 0.707);
2186 *rgba++ = (
unsigned char)R;
2187 *rgba++ = (
unsigned char)G;
2188 *rgba++ = (
unsigned char)B;
2202 for (
unsigned int i = 0; i < size; i++) {
2203 int U = (int)((*yuv++ - 128) * 0.354);
2206 int V = (int)((*yuv++ - 128) * 0.707);
2232 *rgb++ = (
unsigned char)R;
2233 *rgb++ = (
unsigned char)G;
2234 *rgb++ = (
unsigned char)B;
2248 for (
unsigned int i = 0; i < size; i++) {
2267 int U, V, R, G, B, V2, U5, UV;
2269 unsigned int size = width * height;
2270 unsigned char *iV = yuv + size;
2271 unsigned char *iU = yuv + 5 * size / 4;
2272 for (
unsigned int i = 0; i < height / 2; i++) {
2273 for (
unsigned int j = 0; j < width / 2; j++) {
2274 U = (int)((*iU++ - 128) * 0.354);
2276 V = (int)((*iV++ - 128) * 0.707);
2281 yuv = yuv + width - 1;
2284 yuv = yuv - width + 1;
2308 *rgba++ = (
unsigned char)R;
2309 *rgba++ = (
unsigned char)G;
2310 *rgba++ = (
unsigned char)B;
2332 *rgba++ = (
unsigned char)R;
2333 *rgba++ = (
unsigned char)G;
2334 *rgba++ = (
unsigned char)B;
2336 rgba = rgba + 4 * width - 7;
2357 *rgba++ = (
unsigned char)R;
2358 *rgba++ = (
unsigned char)G;
2359 *rgba++ = (
unsigned char)B;
2381 *rgba++ = (
unsigned char)R;
2382 *rgba++ = (
unsigned char)G;
2383 *rgba++ = (
unsigned char)B;
2385 rgba = rgba - 4 * width + 1;
2403 int U, V, R, G, B, V2, U5, UV;
2405 unsigned int size = width * height;
2406 unsigned char *iV = yuv + size;
2407 unsigned char *iU = yuv + 5 * size / 4;
2408 for (
unsigned int i = 0; i < height / 2; i++) {
2409 for (
unsigned int j = 0; j < width / 2; j++) {
2410 U = (int)((*iU++ - 128) * 0.354);
2412 V = (int)((*iV++ - 128) * 0.707);
2417 yuv = yuv + width - 1;
2420 yuv = yuv - width + 1;
2444 *rgb++ = (
unsigned char)R;
2445 *rgb++ = (
unsigned char)G;
2446 *rgb++ = (
unsigned char)B;
2467 *rgb++ = (
unsigned char)R;
2468 *rgb++ = (
unsigned char)G;
2469 *rgb = (
unsigned char)B;
2470 rgb = rgb + 3 * width - 5;
2491 *rgb++ = (
unsigned char)R;
2492 *rgb++ = (
unsigned char)G;
2493 *rgb++ = (
unsigned char)B;
2514 *rgb++ = (
unsigned char)R;
2515 *rgb++ = (
unsigned char)G;
2516 *rgb = (
unsigned char)B;
2517 rgb = rgb - 3 * width + 1;
2537 int U, V, R, G, B, V2, U5, UV;
2538 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2539 unsigned int size = width * height;
2540 unsigned char *iV = yuv + size;
2541 unsigned char *iU = yuv + 17 * size / 16;
2542 for (
unsigned int i = 0; i < height / 4; i++) {
2543 for (
unsigned int j = 0; j < width / 4; j++) {
2544 U = (int)((*iU++ - 128) * 0.354);
2546 V = (int)((*iV++ - 128) * 0.707);
2553 yuv = yuv + width - 3;
2558 yuv = yuv + width - 3;
2563 yuv = yuv + width - 3;
2568 yuv = yuv - 3 * width + 1;
2592 *rgba++ = (
unsigned char)R;
2593 *rgba++ = (
unsigned char)G;
2594 *rgba++ = (
unsigned char)B;
2616 *rgba++ = (
unsigned char)R;
2617 *rgba++ = (
unsigned char)G;
2618 *rgba++ = (
unsigned char)B;
2640 *rgba++ = (
unsigned char)R;
2641 *rgba++ = (
unsigned char)G;
2642 *rgba++ = (
unsigned char)B;
2664 *rgba++ = (
unsigned char)R;
2665 *rgba++ = (
unsigned char)G;
2666 *rgba++ = (
unsigned char)B;
2668 rgba = rgba + 4 * width - 15;
2688 *rgba++ = (
unsigned char)R;
2689 *rgba++ = (
unsigned char)G;
2690 *rgba++ = (
unsigned char)B;
2712 *rgba++ = (
unsigned char)R;
2713 *rgba++ = (
unsigned char)G;
2714 *rgba++ = (
unsigned char)B;
2736 *rgba++ = (
unsigned char)R;
2737 *rgba++ = (
unsigned char)G;
2738 *rgba++ = (
unsigned char)B;
2760 *rgba++ = (
unsigned char)R;
2761 *rgba++ = (
unsigned char)G;
2762 *rgba++ = (
unsigned char)B;
2764 rgba = rgba + 4 * width - 15;
2784 *rgba++ = (
unsigned char)R;
2785 *rgba++ = (
unsigned char)G;
2786 *rgba++ = (
unsigned char)B;
2808 *rgba++ = (
unsigned char)R;
2809 *rgba++ = (
unsigned char)G;
2810 *rgba++ = (
unsigned char)B;
2832 *rgba++ = (
unsigned char)R;
2833 *rgba++ = (
unsigned char)G;
2834 *rgba++ = (
unsigned char)B;
2856 *rgba++ = (
unsigned char)R;
2857 *rgba++ = (
unsigned char)G;
2858 *rgba++ = (
unsigned char)B;
2860 rgba = rgba + 4 * width - 15;
2880 *rgba++ = (
unsigned char)R;
2881 *rgba++ = (
unsigned char)G;
2882 *rgba++ = (
unsigned char)B;
2904 *rgba++ = (
unsigned char)R;
2905 *rgba++ = (
unsigned char)G;
2906 *rgba++ = (
unsigned char)B;
2928 *rgba++ = (
unsigned char)R;
2929 *rgba++ = (
unsigned char)G;
2930 *rgba++ = (
unsigned char)B;
2952 *rgba++ = (
unsigned char)R;
2953 *rgba++ = (
unsigned char)G;
2954 *rgba++ = (
unsigned char)B;
2956 rgba = rgba - 12 * width + 1;
2973 int U, V, R, G, B, V2, U5, UV;
2974 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2975 unsigned int size = width * height;
2976 unsigned char *iV = yuv + size;
2977 unsigned char *iU = yuv + 17 * size / 16;
2978 for (
unsigned int i = 0; i < height / 4; i++) {
2979 for (
unsigned int j = 0; j < width / 4; j++) {
2980 U = (int)((*iU++ - 128) * 0.354);
2982 V = (int)((*iV++ - 128) * 0.707);
2989 yuv = yuv + width - 3;
2994 yuv = yuv + width - 3;
2999 yuv = yuv + width - 3;
3004 yuv = yuv - 3 * width + 1;
3028 *rgb++ = (
unsigned char)R;
3029 *rgb++ = (
unsigned char)G;
3030 *rgb++ = (
unsigned char)B;
3051 *rgb++ = (
unsigned char)R;
3052 *rgb++ = (
unsigned char)G;
3053 *rgb++ = (
unsigned char)B;
3074 *rgb++ = (
unsigned char)R;
3075 *rgb++ = (
unsigned char)G;
3076 *rgb++ = (
unsigned char)B;
3097 *rgb++ = (
unsigned char)R;
3098 *rgb++ = (
unsigned char)G;
3099 *rgb = (
unsigned char)B;
3100 rgb = rgb + 3 * width - 11;
3120 *rgb++ = (
unsigned char)R;
3121 *rgb++ = (
unsigned char)G;
3122 *rgb++ = (
unsigned char)B;
3143 *rgb++ = (
unsigned char)R;
3144 *rgb++ = (
unsigned char)G;
3145 *rgb++ = (
unsigned char)B;
3166 *rgb++ = (
unsigned char)R;
3167 *rgb++ = (
unsigned char)G;
3168 *rgb++ = (
unsigned char)B;
3189 *rgb++ = (
unsigned char)R;
3190 *rgb++ = (
unsigned char)G;
3191 *rgb = (
unsigned char)B;
3192 rgb = rgb + 3 * width - 11;
3212 *rgb++ = (
unsigned char)R;
3213 *rgb++ = (
unsigned char)G;
3214 *rgb++ = (
unsigned char)B;
3235 *rgb++ = (
unsigned char)R;
3236 *rgb++ = (
unsigned char)G;
3237 *rgb++ = (
unsigned char)B;
3258 *rgb++ = (
unsigned char)R;
3259 *rgb++ = (
unsigned char)G;
3260 *rgb++ = (
unsigned char)B;
3281 *rgb++ = (
unsigned char)R;
3282 *rgb++ = (
unsigned char)G;
3283 *rgb = (
unsigned char)B;
3284 rgb = rgb + 3 * width - 11;
3304 *rgb++ = (
unsigned char)R;
3305 *rgb++ = (
unsigned char)G;
3306 *rgb++ = (
unsigned char)B;
3327 *rgb++ = (
unsigned char)R;
3328 *rgb++ = (
unsigned char)G;
3329 *rgb++ = (
unsigned char)B;
3350 *rgb++ = (
unsigned char)R;
3351 *rgb++ = (
unsigned char)G;
3352 *rgb++ = (
unsigned char)B;
3373 *rgb++ = (
unsigned char)R;
3374 *rgb++ = (
unsigned char)G;
3375 *rgb++ = (
unsigned char)B;
3376 rgb = rgb - 9 * width + 1;
3420 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3423 unsigned char *src = (flip) ? (rgb + (width * height * 3) + lineStep) : rgb;
3428 for (i = 0; i < height; i++) {
3429 unsigned char *line = src;
3430 for (j = 0; j < width; j++) {
3431 *rgba++ = *(line++);
3432 *rgba++ = *(line++);
3433 *rgba++ = *(line++);
3456 SimdBgraToBgr(rgba, size, 1, size * 4, rgb, size * 3);
3493 SimdRgbToGray(rgb, width, height, width * 3, grey, width);
3497 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3500 unsigned char *src = (flip) ? rgb + (width * height * 3) + lineStep : rgb;
3507 for (i = 0; i < height; i++) {
3508 unsigned char *line = src;
3509 for (j = 0; j < width; j++) {
3513 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
3546 omp_set_num_threads(
static_cast<int>(nThreads));
3548 #pragma omp parallel for
3550 for (
int i = 0; i < static_cast<int>(height); i++) {
3551 SimdRgbaToGray(rgba + i * width * 4, width, 1, width * 4, grey + i * width, width);
3571 SimdRgbaToGray(rgba, size, 1, size * 4, grey, size);
3619 SimdGrayToBgr(grey, size, 1, size, rgb, size * 3);
3645 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3648 unsigned char *src = (flip) ? (bgr + (width * height * 3) + lineStep) : bgr;
3650 for (
unsigned int i = 0; i < height; i++) {
3651 unsigned char *line = src;
3652 for (
unsigned int j = 0; j < width; j++) {
3653 *rgba++ = *(line + 2);
3654 *rgba++ = *(line + 1);
3655 *rgba++ = *(line + 0);
3684 SimdBgraToRgba(bgra, width, height, width * 4, rgba, width * 4);
3688 int lineStep = (flip) ? -(
int)(width * 4) : (
int)(width * 4);
3691 unsigned char *src = (flip) ? (bgra + (width * height * 4) + lineStep) : bgra;
3693 for (
unsigned int i = 0; i < height; i++) {
3694 unsigned char *line = src;
3695 for (
unsigned int j = 0; j < width; j++) {
3696 *rgba++ = *(line + 2);
3697 *rgba++ = *(line + 1);
3698 *rgba++ = *(line + 0);
3699 *rgba++ = *(line + 3);
3734 omp_set_num_threads(
static_cast<int>(nThreads));
3736 #pragma omp parallel for
3738 for (
int i = 0; i < static_cast<int>(height); i++) {
3739 SimdBgrToGray(bgr + i * width * 3, width, 1, width * 3, grey + i * width, width);
3744 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3747 unsigned char *src = (flip) ? bgr + (width * height * 3) + lineStep : bgr;
3749 for (
unsigned int i = 0; i < height; i++) {
3750 unsigned char *line = src;
3751 for (
unsigned int j = 0; j < width; j++) {
3752 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3787 omp_set_num_threads(
static_cast<int>(nThreads));
3789 #pragma omp parallel for
3791 for (
int i = 0; i < static_cast<int>(height); i++) {
3792 SimdBgraToGray(bgra + i * width * 4, width, 1, width * 4, grey + i * width, width);
3797 int lineStep = (flip) ? -(
int)(width * 4) : (
int)(width * 4);
3800 unsigned char *src = (flip) ? bgra + (width * height * 4) + lineStep : bgra;
3802 for (
unsigned int i = 0; i < height; i++) {
3803 unsigned char *line = src;
3804 for (
unsigned int j = 0; j < width; j++) {
3805 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3818 void vpImageConvert::computeYCbCrLUT()
3820 if (YCbCrLUTcomputed ==
false) {
3825 int aux = index - 128;
3826 vpImageConvert::vpCrr[index] = (int)(364.6610 * aux) >> 8;
3827 vpImageConvert::vpCgb[index] = (int)(-89.8779 * aux) >> 8;
3828 vpImageConvert::vpCgr[index] = (int)(-185.8154 * aux) >> 8;
3829 vpImageConvert::vpCbb[index] = (int)(460.5724 * aux) >> 8;
3832 YCbCrLUTcomputed =
true;
3861 unsigned char *pt_ycbcr = ycbcr;
3862 unsigned char *pt_rgb = rgb;
3866 vpImageConvert::computeYCbCrLUT();
3871 int val_r, val_g, val_b;
3877 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3878 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3879 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3881 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3883 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3884 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3885 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3920 unsigned char *pt_ycbcr = ycbcr;
3921 unsigned char *pt_rgba = rgba;
3925 vpImageConvert::computeYCbCrLUT();
3930 int val_r, val_g, val_b;
3936 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3937 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3938 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3940 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3942 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3943 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3944 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3972 unsigned int i = 0, j = 0;
3974 while (j < size * 2) {
3975 grey[i++] = ycbcr[j];
3976 grey[i++] = ycbcr[j + 2];
4006 unsigned char *pt_ycbcr = ycrcb;
4007 unsigned char *pt_rgb = rgb;
4011 vpImageConvert::computeYCbCrLUT();
4016 int val_r, val_g, val_b;
4022 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
4023 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
4024 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
4026 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
4028 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
4029 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
4030 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
4064 unsigned char *pt_ycbcr = ycrcb;
4065 unsigned char *pt_rgba = rgba;
4069 vpImageConvert::computeYCbCrLUT();
4074 int val_r, val_g, val_b;
4080 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
4081 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
4082 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
4084 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
4086 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
4087 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
4088 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
4150 unsigned char *ptrR = pR ? pR->
bitmap :
new unsigned char[src.
getSize()];
4151 unsigned char *ptrG = pG ? pG->
bitmap :
new unsigned char[src.
getSize()];
4152 unsigned char *ptrB = pB ? pB->
bitmap :
new unsigned char[src.
getSize()];
4153 unsigned char *ptrA = pa ? pa->
bitmap :
new unsigned char[src.
getSize()];
4188 std::map<unsigned int, unsigned int> mapOfWidths, mapOfHeights;
4209 if (mapOfWidths.size() == 1 && mapOfHeights.size() == 1) {
4210 unsigned int width = mapOfWidths.begin()->first;
4211 unsigned int height = mapOfHeights.begin()->first;
4213 RGBa.
resize(height, width);
4215 if (R != NULL && G != NULL && B != NULL && a != NULL) {
4216 SimdInterleaveBgra(R->
bitmap, width, G->
bitmap, width, B->
bitmap, width, a->
bitmap, width, width, height,
4217 reinterpret_cast<uint8_t *
>(RGBa.
bitmap), width *
sizeof(
vpRGBa));
4219 unsigned int size = width * height;
4220 for (
unsigned int i = 0; i < size; i++) {
4255 int i = (((int)size) << 1) - 1;
4256 int j = (int)size - 1;
4259 int y = grey16[i--];
4260 grey[j--] =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4277 int i = (((int)size) << 1) - 1;
4278 int j = (int)(size * 4 - 1);
4281 int y = grey16[i--];
4282 unsigned char v =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4300 void vpImageConvert::HSV2RGB(
const double *hue_,
const double *saturation_,
const double *value_,
unsigned char *rgb,
4301 unsigned int size,
unsigned int step)
4303 for (
unsigned int i = 0; i < size; i++) {
4304 double hue = hue_[i], saturation = saturation_[i], value = value_[i];
4306 if (
vpMath::equal(saturation, 0.0, std::numeric_limits<double>::epsilon())) {
4310 double h = hue * 6.0;
4311 double s = saturation;
4314 if (
vpMath::equal(h, 6.0, std::numeric_limits<double>::epsilon())) {
4318 double f = h - (int)h;
4319 double p = v * (1.0 - s);
4320 double q = v * (1.0 - s * f);
4321 double t = v * (1.0 - s * (1.0 - f));
4363 rgb[i * step + 1] = (
unsigned char)
vpMath::round(saturation * 255.0);
4364 rgb[i * step + 2] = (
unsigned char)
vpMath::round(value * 255.0);
4380 void vpImageConvert::RGB2HSV(
const unsigned char *rgb,
double *hue,
double *saturation,
double *value,
4381 unsigned int size,
unsigned int step)
4383 for (
unsigned int i = 0; i < size; i++) {
4384 double red, green, blue;
4388 red = rgb[i * step] / 255.0;
4389 green = rgb[i * step + 1] / 255.0;
4390 blue = rgb[i * step + 2] / 255.0;
4393 max = ((std::max))(red, blue);
4394 min = ((std::min))(green, blue);
4396 max = ((std::max))(green, blue);
4397 min = ((std::min))(red, blue);
4402 if (!
vpMath::equal(max, 0.0, std::numeric_limits<double>::epsilon())) {
4403 s = (max - min) / max;
4408 if (
vpMath::equal(s, 0.0, std::numeric_limits<double>::epsilon())) {
4411 double delta = max - min;
4412 if (
vpMath::equal(delta, 0.0, std::numeric_limits<double>::epsilon())) {
4416 if (
vpMath::equal(red, max, std::numeric_limits<double>::epsilon())) {
4417 h = (green - blue) / delta;
4418 }
else if (
vpMath::equal(green, max, std::numeric_limits<double>::epsilon())) {
4419 h = 2 + (blue - red) / delta;
4421 h = 4 + (red - green) / delta;
4427 }
else if (h > 1.0) {
4453 vpImageConvert::HSV2RGB(hue, saturation, value, rgba, size, 4);
4469 unsigned char *rgba,
unsigned int size)
4471 for (
unsigned int i = 0; i < size; i++) {
4472 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4493 vpImageConvert::RGB2HSV(rgba, hue, saturation, value, size, 4);
4508 unsigned char *value,
unsigned int size)
4510 for (
unsigned int i = 0; i < size; i++) {
4514 hue[i] = (
unsigned char)(255.0 * h);
4515 saturation[i] = (
unsigned char)(255.0 * s);
4516 value[i] = (
unsigned char)(255.0 * v);
4533 vpImageConvert::HSV2RGB(hue, saturation, value, rgb, size, 3);
4547 unsigned char *rgb,
unsigned int size)
4549 for (
unsigned int i = 0; i < size; i++) {
4550 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4570 vpImageConvert::RGB2HSV(rgb, hue, saturation, value, size, 3);
4584 unsigned char *value,
unsigned int size)
4586 for (
unsigned int i = 0; i < size; i++) {
4591 hue[i] = (
unsigned char)(255.0 * h);
4592 saturation[i] = (
unsigned char)(255.0 * s);
4593 value[i] = (
unsigned char)(255.0 * v);
4612 unsigned int height,
unsigned int nThreads)
4614 demosaicBGGRToRGBaBilinearTpl(bggr, rgba, width, height, nThreads);
4630 unsigned int height,
unsigned int nThreads)
4632 demosaicBGGRToRGBaBilinearTpl(bggr, rgba, width, height, nThreads);
4648 unsigned int height,
unsigned int nThreads)
4650 demosaicGBRGToRGBaBilinearTpl(gbrg, rgba, width, height, nThreads);
4666 unsigned int height,
unsigned int nThreads)
4668 demosaicGBRGToRGBaBilinearTpl(gbrg, rgba, width, height, nThreads);
4684 unsigned int height,
unsigned int nThreads)
4686 demosaicGRBGToRGBaBilinearTpl(grbg, rgba, width, height, nThreads);
4702 unsigned int height,
unsigned int nThreads)
4704 demosaicGRBGToRGBaBilinearTpl(grbg, rgba, width, height, nThreads);
4720 unsigned int height,
unsigned int nThreads)
4722 demosaicRGGBToRGBaBilinearTpl(rggb, rgba, width, height, nThreads);
4738 unsigned int height,
unsigned int nThreads)
4740 demosaicRGGBToRGBaBilinearTpl(rggb, rgba, width, height, nThreads);
4758 unsigned int height,
unsigned int nThreads)
4760 demosaicBGGRToRGBaMalvarTpl(bggr, rgba, width, height, nThreads);
4776 unsigned int height,
unsigned int nThreads)
4778 demosaicBGGRToRGBaMalvarTpl(bggr, rgba, width, height, nThreads);
4794 unsigned int height,
unsigned int nThreads)
4796 demosaicGBRGToRGBaMalvarTpl(gbrg, rgba, width, height, nThreads);
4812 unsigned int height,
unsigned int nThreads)
4814 demosaicGBRGToRGBaMalvarTpl(gbrg, rgba, width, height, nThreads);
4830 unsigned int height,
unsigned int nThreads)
4832 demosaicGRBGToRGBaMalvarTpl(grbg, rgba, width, height, nThreads);
4848 unsigned int height,
unsigned int nThreads)
4850 demosaicGRBGToRGBaMalvarTpl(grbg, rgba, width, height, nThreads);
4866 unsigned int height,
unsigned int nThreads)
4868 demosaicRGGBToRGBaMalvarTpl(rggb, rgba, width, height, nThreads);
4884 unsigned int height,
unsigned int nThreads)
4886 demosaicRGGBToRGBaMalvarTpl(rggb, rgba, width, height, nThreads);
error that can be emited by ViSP classes.
@ dimensionError
Bad dimension.
static void YUV411ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void YVU9ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void MONO16ToGrey(unsigned char *grey16, unsigned char *grey, unsigned int size)
static void HSVToRGBa(const double *hue, const double *saturation, const double *value, unsigned char *rgba, unsigned int size)
static void YUYVToRGBa(unsigned char *yuyv, unsigned char *rgba, unsigned int width, unsigned int height)
static void demosaicBGGRToRGBaBilinear(const uint8_t *bggr, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void demosaicGRBGToRGBaBilinear(const uint8_t *grbg, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
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 RGBToHSV(const unsigned char *rgb, double *hue, double *saturation, double *value, unsigned int size)
static void demosaicGRBGToRGBaMalvar(const uint8_t *grbg, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void YUV422ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void YUV420ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void YUYVToGrey(unsigned char *yuyv, unsigned char *grey, unsigned int size)
static void YUV411ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YUV420ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void demosaicGBRGToRGBaMalvar(const uint8_t *gbrg, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void YVU9ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
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 YV12ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int width, unsigned int height)
static void YUV444ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void demosaicBGGRToRGBaMalvar(const uint8_t *bggr, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void YUV411ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void YUVToRGB(unsigned char y, unsigned char u, unsigned char v, unsigned char &r, unsigned char &g, unsigned char &b)
static void demosaicGBRGToRGBaBilinear(const uint8_t *gbrg, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void YCbCrToGrey(unsigned char *ycbcr, unsigned char *grey, unsigned int size)
static void YUV422ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int size)
static void YCrCbToRGB(unsigned char *ycrcb, unsigned char *rgb, unsigned int size)
static void YCbCrToRGBa(unsigned char *ycbcr, unsigned char *rgb, unsigned int size)
static void createDepthHistogram(const vpImage< uint16_t > &src_depth, vpImage< vpRGBa > &dest_rgba)
static void RGBaToHSV(const unsigned char *rgba, double *hue, double *saturation, double *value, unsigned int size)
static void demosaicRGGBToRGBaMalvar(const uint8_t *rggb, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void GreyToRGBa(unsigned char *grey, unsigned char *rgba, unsigned int width, unsigned int height)
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
static void MONO16ToRGBa(unsigned char *grey16, unsigned char *rgba, unsigned int size)
static void RGBToGrey(unsigned char *rgb, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false)
static void RGBaToGrey(unsigned char *rgba, unsigned char *grey, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void GreyToRGB(unsigned char *grey, unsigned char *rgb, unsigned int size)
static void YCrCbToRGBa(unsigned char *ycrcb, unsigned char *rgb, unsigned int size)
static void RGBToRGBa(unsigned char *rgb, unsigned char *rgba, unsigned int size)
static void YCbCrToRGB(unsigned char *ycbcr, 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 YUV422ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void YV12ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
static void BGRToGrey(unsigned char *bgr, unsigned char *grey, unsigned int width, unsigned int height, bool flip=false, unsigned int nThreads=0)
static void BGRToRGBa(unsigned char *bgr, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
static void demosaicRGGBToRGBaBilinear(const uint8_t *rggb, uint8_t *rgba, unsigned int width, unsigned int height, unsigned int nThreads=0)
static void YUV444ToRGBa(unsigned char *yuv, unsigned char *rgba, unsigned int size)
static void BGRaToRGBa(unsigned char *bgra, unsigned char *rgba, unsigned int width, unsigned int height, bool flip=false)
static void RGBaToRGB(unsigned char *rgba, unsigned char *rgb, unsigned int size)
static void YUV444ToGrey(unsigned char *yuv, unsigned char *grey, unsigned int size)
static void YUV420ToRGB(unsigned char *yuv, unsigned char *rgb, unsigned int width, unsigned int height)
static void HSVToRGB(const double *hue, const double *saturation, const double *value, unsigned char *rgb, unsigned int size)
static void YUYVToRGB(unsigned char *yuyv, unsigned char *rgb, unsigned int width, unsigned int height)
unsigned int getWidth() const
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
unsigned int getSize() const
unsigned int getCols() const
Type * bitmap
points toward the bitmap
unsigned int getHeight() const
unsigned int getRows() const
void getMinMaxValue(Type &min, Type &max, bool onlyFiniteVal=true) const
Look for the minimum and the maximum value within the bitmap.
static bool equal(double x, double y, double s=0.001)
static int round(double x)
unsigned char B
Blue component.
unsigned char R
Red component.
unsigned char G
Green component.
unsigned char A
Additionnal component.