49 #include "private/vpBayerConversion.h"
50 #include "private/vpImageConvert_impl.h"
51 #include <Simd/SimdLib.hpp>
52 #include <visp3/core/vpImageConvert.h>
54 bool vpImageConvert::YCbCrLUTcomputed =
false;
55 int vpImageConvert::vpCrr[256];
56 int vpImageConvert::vpCgb[256];
57 int vpImageConvert::vpCgr[256];
58 int vpImageConvert::vpCbb[256];
105 for (
unsigned int i = 0; i < max_xy; i++) {
106 float val = 255.f * (src.
bitmap[i] - min) / (max - min);
112 dest.
bitmap[i] = (
unsigned char)val;
128 for (
unsigned int i = 0; i < src.
getHeight(); i++) {
129 for (
unsigned int j = 0; j < src.
getWidth(); j++) {
130 for (
unsigned int c = 0; c < 3; c++) {
131 float val = 255.f * (
reinterpret_cast<const float *
>(&(src[i][j]))[c] -
reinterpret_cast<float *
>(&min)[c]) /
132 (
reinterpret_cast<float *
>(&max)[c] -
reinterpret_cast<float *
>(&min)[c]);
134 reinterpret_cast<unsigned char *
>(&(dest[i][j]))[c] = 0;
136 reinterpret_cast<unsigned char *
>(&(dest[i][j]))[c] = 255;
138 reinterpret_cast<unsigned char *
>(&(dest[i][j]))[c] = (
unsigned char)val;
170 for (
unsigned int i = 0; i < max_xy; i++) {
171 double val = 255. * (src.
bitmap[i] - min) / (max - min);
177 dest.
bitmap[i] = (
unsigned char)val;
191 for (
unsigned int i = 0; i < src.
getSize(); i++)
192 dest.
bitmap[i] =
static_cast<unsigned char>(src.
bitmap[i] >> bitshift);
205 for (
unsigned int i = 0; i < src.
getSize(); i++)
206 dest.
bitmap[i] =
static_cast<unsigned char>(src.
bitmap[i] << bitshift);
230 vp_createDepthHistogram(src_depth, dest_rgba);
241 vp_createDepthHistogram(src_depth, dest_depth);
253 vp_createDepthHistogram(src_depth, dest_rgba);
264 vp_createDepthHistogram(src_depth, dest_depth);
267 #if defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_IMGPROC)
311 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
313 if (src.type() == CV_8UC4) {
315 for (
unsigned int i = 0; i < dest.
getRows(); ++i)
316 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
317 cv::Vec4b tmp = src.at<cv::Vec4b>((int)i, (
int)j);
323 dest[dest.
getRows() - i - 1][j] = rgbaVal;
325 dest[i][j] = rgbaVal;
328 else if (src.type() == CV_8UC3) {
329 if (src.isContinuous() && !flip) {
330 SimdRgbToBgra(src.data, src.cols, src.rows, src.step[0],
reinterpret_cast<uint8_t *
>(dest.
bitmap),
336 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
337 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
338 cv::Vec3b tmp = src.at<cv::Vec3b>((int)i, (
int)j);
343 dest[dest.
getRows() - i - 1][j] = rgbaVal;
346 dest[i][j] = rgbaVal;
352 else if (src.type() == CV_8UC1) {
353 if (src.isContinuous() && !flip) {
354 SimdGrayToBgra(src.data, src.cols, src.rows, src.step[0],
reinterpret_cast<uint8_t *
>(dest.
bitmap),
359 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
360 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
361 rgbaVal = src.at<
unsigned char>((int)i, (
int)j);
363 dest[dest.
getRows() - i - 1][j] = rgbaVal;
366 dest[i][j] = rgbaVal;
411 if (src.type() == CV_8UC1) {
412 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
413 if (src.isContinuous() && !flip) {
414 memcpy(dest.
bitmap, src.data, (
size_t)(src.rows * src.cols));
418 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
419 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + (dest.
getRows() - i - 1) * src.step1(), (
size_t)src.step);
423 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
424 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + i * src.step1(), (
size_t)src.step);
429 else if (src.type() == CV_8UC3) {
430 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
431 if (src.isContinuous()) {
432 BGRToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols, (
unsigned int)src.rows,
437 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
438 BGRToGrey((
unsigned char *)src.data + i * src.step1(),
440 (
unsigned int)dest.
getCols(), 1,
false);
444 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
446 (
unsigned int)dest.
getCols(), 1,
false);
451 else if (src.type() == CV_8UC4) {
452 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
453 if (src.isContinuous()) {
454 BGRaToGrey((
unsigned char *)src.data, (
unsigned char *)dest.
bitmap, (
unsigned int)src.cols,
455 (
unsigned int)src.rows, flip, nThreads);
459 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
460 BGRaToGrey((
unsigned char *)src.data + i * src.step1(),
462 (
unsigned int)dest.
getCols(), 1,
false);
466 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
468 (
unsigned int)dest.
getCols(), 1,
false);
484 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
486 if (src.type() == CV_32FC1) {
487 for (
unsigned int i = 0; i < dest.
getRows(); ++i)
488 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
490 dest[dest.
getRows() - i - 1][j] = src.at<
float>((int)i, (
int)j);
492 dest[i][j] = src.at<
float>((int)i, (
int)j);
509 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
511 if (src.type() == CV_16UC1) {
512 if (src.isContinuous()) {
513 memcpy(dest.
bitmap, src.data, (
size_t)(src.rows * src.cols) *
sizeof(uint16_t));
517 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
518 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + (dest.
getRows() - i - 1) * src.step1() *
sizeof(uint16_t), (
size_t)src.step);
522 for (
unsigned int i = 0; i < dest.
getRows(); ++i) {
523 memcpy(dest.
bitmap + i * dest.
getCols(), src.data + i * src.step1() *
sizeof(uint16_t), (
size_t)src.step);
542 dest.
resize((
unsigned int)src.rows, (
unsigned int)src.cols);
544 if (src.type() == CV_32FC3) {
546 for (
unsigned int i = 0; i < dest.
getRows(); ++i)
547 for (
unsigned int j = 0; j < dest.
getCols(); ++j) {
548 cv::Vec3f tmp = src.at<cv::Vec3f>((int)i, (
int)j);
553 dest[dest.
getRows() - i - 1][j] = rgbVal;
602 cv::cvtColor(vpToMat, dest, cv::COLOR_RGBA2BGR);
647 dest = tmpMap.clone();
658 dest = tmpMap.clone();
668 cv::cvtColor(vpToMat, dest, cv::COLOR_RGB2BGR);
673 #ifdef VISP_HAVE_YARP
759 dest.
resize(src->height(), src->width());
761 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelMono));
763 dest.
bitmap = src->getRawImage();
850 dest.
resize(src->height(), src->width());
852 memcpy(dest.
bitmap, src->getRawImage(), src->height() * src->width() *
sizeof(yarp::sig::PixelRgba));
854 dest.
bitmap =
static_cast<vpRGBa *
>(src->getRawImage());
892 for (
unsigned int i = 0; i < src.
getRows(); i++) {
893 for (
unsigned int j = 0; j < src.
getWidth(); j++) {
894 dest->pixel(j, i).r = src[i][j].R;
895 dest->pixel(j, i).g = src[i][j].G;
896 dest->pixel(j, i).b = src[i][j].B;
941 dest.
resize(src->height(), src->width());
942 for (
int i = 0; i < src->height(); i++) {
943 for (
int j = 0; j < src->width(); j++) {
944 dest[i][j].R = src->pixel(j, i).r;
945 dest[i][j].G = src->pixel(j, i).g;
946 dest[i][j].B = src->pixel(j, i).b;
978 int r, g, b, cr, cg, cb, y1, y2;
988 cb = ((*s - 128) * 454) >> 8;
989 cg = (*s++ - 128) * 88;
991 cr = ((*s - 128) * 359) >> 8;
992 cg = (cg + (*s++ - 128) * 183) >> 8;
997 vpSAT(r) vpSAT(g) vpSAT(b)
999 *d++ =
static_cast<unsigned char>(r);
1000 *d++ =
static_cast<unsigned char>(g);
1001 *d++ =
static_cast<unsigned char>(b);
1007 vpSAT(r) vpSAT(g) vpSAT(b)
1009 *d++ =
static_cast<unsigned char>(r);
1010 *d++ =
static_cast<unsigned char>(g);
1011 *d++ =
static_cast<unsigned char>(b);
1032 int r, g, b, cr, cg, cb, y1, y2;
1042 cb = ((*s - 128) * 454) >> 8;
1043 cg = (*s++ - 128) * 88;
1045 cr = ((*s - 128) * 359) >> 8;
1046 cg = (cg + (*s++ - 128) * 183) >> 8;
1051 vpSAT(r) vpSAT(g) vpSAT(b)
1053 *d++ =
static_cast<unsigned char>(r);
1054 *d++ =
static_cast<unsigned char>(g);
1055 *d++ =
static_cast<unsigned char>(b);
1060 vpSAT(r) vpSAT(g) vpSAT(b)
1062 *d++ =
static_cast<unsigned char>(r);
1063 *d++ =
static_cast<unsigned char>(g);
1064 *d++ =
static_cast<unsigned char>(b);
1081 unsigned int i = 0, j = 0;
1083 while (j < size * 2) {
1084 grey[i++] = yuyv[j];
1085 grey[i++] = yuyv[j + 2];
1103 for (
unsigned int i = size / 4; i; i--) {
1104 int U = (int)((*yuv++ - 128) * 0.354);
1108 int V = (int)((*yuv++ - 128) * 0.707);
1136 *rgba++ = (
unsigned char)R;
1137 *rgba++ = (
unsigned char)G;
1138 *rgba++ = (
unsigned char)B;
1160 *rgba++ = (
unsigned char)R;
1161 *rgba++ = (
unsigned char)G;
1162 *rgba++ = (
unsigned char)B;
1184 *rgba++ = (
unsigned char)R;
1185 *rgba++ = (
unsigned char)G;
1186 *rgba++ = (
unsigned char)B;
1208 *rgba++ = (
unsigned char)R;
1209 *rgba++ = (
unsigned char)G;
1210 *rgba++ = (
unsigned char)B;
1215 unsigned int i = 0, j = 0;
1216 unsigned char r, g, b;
1217 while (j < numpixels * 3 / 2) {
1219 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1226 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1233 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1240 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1269 for (
unsigned int i = size / 2; i; i--) {
1270 int U = (int)((*yuv++ - 128) * 0.354);
1273 int V = (int)((*yuv++ - 128) * 0.707);
1297 *rgba++ = (
unsigned char)R;
1298 *rgba++ = (
unsigned char)G;
1299 *rgba++ = (
unsigned char)B;
1321 *rgba++ = (
unsigned char)R;
1322 *rgba++ = (
unsigned char)G;
1323 *rgba++ = (
unsigned char)B;
1329 unsigned int i = 0, j = 0;
1330 unsigned char r, g, b;
1332 while (j < size * 2) {
1334 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1341 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1362 unsigned int i = 0, j = 0;
1363 while (j < size * 3 / 2) {
1364 grey[i] = yuv[j + 1];
1365 grey[i + 1] = yuv[j + 2];
1366 grey[i + 2] = yuv[j + 4];
1367 grey[i + 3] = yuv[j + 5];
1389 for (
unsigned int i = size / 2; i; i--) {
1390 int U = (int)((*yuv++ - 128) * 0.354);
1393 int V = (int)((*yuv++ - 128) * 0.707);
1417 *rgb++ = (
unsigned char)R;
1418 *rgb++ = (
unsigned char)G;
1419 *rgb++ = (
unsigned char)B;
1440 *rgb++ = (
unsigned char)R;
1441 *rgb++ = (
unsigned char)G;
1442 *rgb++ = (
unsigned char)B;
1447 unsigned int i = 0, j = 0;
1448 unsigned char r, g, b;
1450 while (j < size * 2) {
1452 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 2], r, g, b);
1458 YUVToRGB(yuv[j + 3], yuv[j], yuv[j + 2], r, g, b);
1480 unsigned int i = 0, j = 0;
1482 while (j < size * 2) {
1483 grey[i++] = yuv[j + 1];
1484 grey[i++] = yuv[j + 3];
1501 for (
unsigned int i = size / 4; i; i--) {
1502 int U = (int)((*yuv++ - 128) * 0.354);
1506 int V = (int)((*yuv++ - 128) * 0.707);
1534 *rgb++ = (
unsigned char)R;
1535 *rgb++ = (
unsigned char)G;
1536 *rgb++ = (
unsigned char)B;
1557 *rgb++ = (
unsigned char)R;
1558 *rgb++ = (
unsigned char)G;
1559 *rgb++ = (
unsigned char)B;
1580 *rgb++ = (
unsigned char)R;
1581 *rgb++ = (
unsigned char)G;
1582 *rgb++ = (
unsigned char)B;
1603 *rgb++ = (
unsigned char)R;
1604 *rgb++ = (
unsigned char)G;
1605 *rgb++ = (
unsigned char)B;
1610 unsigned int i = 0, j = 0;
1611 unsigned char r, g, b;
1613 while (j < size * 3 / 2) {
1614 YUVToRGB(yuv[j + 1], yuv[j], yuv[j + 3], r, g, b);
1620 YUVToRGB(yuv[j + 2], yuv[j], yuv[j + 3], r, g, b);
1626 YUVToRGB(yuv[j + 4], yuv[j], yuv[j + 3], r, g, b);
1632 YUVToRGB(yuv[j + 5], yuv[j], yuv[j + 3], r, g, b);
1657 int U, V, R, G, B, V2, U5, UV;
1659 unsigned int size = width * height;
1660 unsigned char *iU = yuv + size;
1661 unsigned char *iV = yuv + 5 * size / 4;
1662 for (
unsigned int i = 0; i < height / 2; i++) {
1663 for (
unsigned int j = 0; j < width / 2; j++) {
1664 U = (int)((*iU++ - 128) * 0.354);
1666 V = (int)((*iV++ - 128) * 0.707);
1671 yuv = yuv + width - 1;
1674 yuv = yuv - width + 1;
1698 *rgba++ = (
unsigned char)R;
1699 *rgba++ = (
unsigned char)G;
1700 *rgba++ = (
unsigned char)B;
1722 *rgba++ = (
unsigned char)R;
1723 *rgba++ = (
unsigned char)G;
1724 *rgba++ = (
unsigned char)B;
1726 rgba = rgba + 4 * width - 7;
1747 *rgba++ = (
unsigned char)R;
1748 *rgba++ = (
unsigned char)G;
1749 *rgba++ = (
unsigned char)B;
1771 *rgba++ = (
unsigned char)R;
1772 *rgba++ = (
unsigned char)G;
1773 *rgba++ = (
unsigned char)B;
1775 rgba = rgba - 4 * width + 1;
1793 int U, V, R, G, B, V2, U5, UV;
1795 unsigned int size = width * height;
1796 unsigned char *iU = yuv + size;
1797 unsigned char *iV = yuv + 5 * size / 4;
1798 for (
unsigned int i = 0; i < height / 2; i++) {
1799 for (
unsigned int j = 0; j < width / 2; j++) {
1800 U = (int)((*iU++ - 128) * 0.354);
1802 V = (int)((*iV++ - 128) * 0.707);
1807 yuv = yuv + width - 1;
1810 yuv = yuv - width + 1;
1834 *rgb++ = (
unsigned char)R;
1835 *rgb++ = (
unsigned char)G;
1836 *rgb++ = (
unsigned char)B;
1857 *rgb++ = (
unsigned char)R;
1858 *rgb++ = (
unsigned char)G;
1859 *rgb = (
unsigned char)B;
1860 rgb = rgb + 3 * width - 5;
1881 *rgb++ = (
unsigned char)R;
1882 *rgb++ = (
unsigned char)G;
1883 *rgb++ = (
unsigned char)B;
1904 *rgb++ = (
unsigned char)R;
1905 *rgb++ = (
unsigned char)G;
1906 *rgb = (
unsigned char)B;
1907 rgb = rgb - 3 * width + 1;
1923 for (
unsigned int i = 0; i < size; i++) {
1939 for (
unsigned int i = 0; i < size; i++) {
1940 int U = (int)((*yuv++ - 128) * 0.354);
1943 int V = (int)((*yuv++ - 128) * 0.707);
1969 *rgba++ = (
unsigned char)R;
1970 *rgba++ = (
unsigned char)G;
1971 *rgba++ = (
unsigned char)B;
1985 for (
unsigned int i = 0; i < size; i++) {
1986 int U = (int)((*yuv++ - 128) * 0.354);
1989 int V = (int)((*yuv++ - 128) * 0.707);
2015 *rgb++ = (
unsigned char)R;
2016 *rgb++ = (
unsigned char)G;
2017 *rgb++ = (
unsigned char)B;
2031 for (
unsigned int i = 0; i < size; i++) {
2050 int U, V, R, G, B, V2, U5, UV;
2052 unsigned int size = width * height;
2053 unsigned char *iV = yuv + size;
2054 unsigned char *iU = yuv + 5 * size / 4;
2055 for (
unsigned int i = 0; i < height / 2; i++) {
2056 for (
unsigned int j = 0; j < width / 2; j++) {
2057 U = (int)((*iU++ - 128) * 0.354);
2059 V = (int)((*iV++ - 128) * 0.707);
2064 yuv = yuv + width - 1;
2067 yuv = yuv - width + 1;
2091 *rgba++ = (
unsigned char)R;
2092 *rgba++ = (
unsigned char)G;
2093 *rgba++ = (
unsigned char)B;
2115 *rgba++ = (
unsigned char)R;
2116 *rgba++ = (
unsigned char)G;
2117 *rgba++ = (
unsigned char)B;
2119 rgba = rgba + 4 * width - 7;
2140 *rgba++ = (
unsigned char)R;
2141 *rgba++ = (
unsigned char)G;
2142 *rgba++ = (
unsigned char)B;
2164 *rgba++ = (
unsigned char)R;
2165 *rgba++ = (
unsigned char)G;
2166 *rgba++ = (
unsigned char)B;
2168 rgba = rgba - 4 * width + 1;
2186 int U, V, R, G, B, V2, U5, UV;
2188 unsigned int size = width * height;
2189 unsigned char *iV = yuv + size;
2190 unsigned char *iU = yuv + 5 * size / 4;
2191 for (
unsigned int i = 0; i < height / 2; i++) {
2192 for (
unsigned int j = 0; j < width / 2; j++) {
2193 U = (int)((*iU++ - 128) * 0.354);
2195 V = (int)((*iV++ - 128) * 0.707);
2200 yuv = yuv + width - 1;
2203 yuv = yuv - width + 1;
2227 *rgb++ = (
unsigned char)R;
2228 *rgb++ = (
unsigned char)G;
2229 *rgb++ = (
unsigned char)B;
2250 *rgb++ = (
unsigned char)R;
2251 *rgb++ = (
unsigned char)G;
2252 *rgb = (
unsigned char)B;
2253 rgb = rgb + 3 * width - 5;
2274 *rgb++ = (
unsigned char)R;
2275 *rgb++ = (
unsigned char)G;
2276 *rgb++ = (
unsigned char)B;
2297 *rgb++ = (
unsigned char)R;
2298 *rgb++ = (
unsigned char)G;
2299 *rgb = (
unsigned char)B;
2300 rgb = rgb - 3 * width + 1;
2320 int U, V, R, G, B, V2, U5, UV;
2321 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2322 unsigned int size = width * height;
2323 unsigned char *iV = yuv + size;
2324 unsigned char *iU = yuv + 17 * size / 16;
2325 for (
unsigned int i = 0; i < height / 4; i++) {
2326 for (
unsigned int j = 0; j < width / 4; j++) {
2327 U = (int)((*iU++ - 128) * 0.354);
2329 V = (int)((*iV++ - 128) * 0.707);
2336 yuv = yuv + width - 3;
2341 yuv = yuv + width - 3;
2346 yuv = yuv + width - 3;
2351 yuv = yuv - 3 * width + 1;
2375 *rgba++ = (
unsigned char)R;
2376 *rgba++ = (
unsigned char)G;
2377 *rgba++ = (
unsigned char)B;
2399 *rgba++ = (
unsigned char)R;
2400 *rgba++ = (
unsigned char)G;
2401 *rgba++ = (
unsigned char)B;
2423 *rgba++ = (
unsigned char)R;
2424 *rgba++ = (
unsigned char)G;
2425 *rgba++ = (
unsigned char)B;
2447 *rgba++ = (
unsigned char)R;
2448 *rgba++ = (
unsigned char)G;
2449 *rgba++ = (
unsigned char)B;
2451 rgba = rgba + 4 * width - 15;
2471 *rgba++ = (
unsigned char)R;
2472 *rgba++ = (
unsigned char)G;
2473 *rgba++ = (
unsigned char)B;
2495 *rgba++ = (
unsigned char)R;
2496 *rgba++ = (
unsigned char)G;
2497 *rgba++ = (
unsigned char)B;
2519 *rgba++ = (
unsigned char)R;
2520 *rgba++ = (
unsigned char)G;
2521 *rgba++ = (
unsigned char)B;
2543 *rgba++ = (
unsigned char)R;
2544 *rgba++ = (
unsigned char)G;
2545 *rgba++ = (
unsigned char)B;
2547 rgba = rgba + 4 * width - 15;
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;
2639 *rgba++ = (
unsigned char)R;
2640 *rgba++ = (
unsigned char)G;
2641 *rgba++ = (
unsigned char)B;
2643 rgba = rgba + 4 * width - 15;
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;
2735 *rgba++ = (
unsigned char)R;
2736 *rgba++ = (
unsigned char)G;
2737 *rgba++ = (
unsigned char)B;
2739 rgba = rgba - 12 * width + 1;
2756 int U, V, R, G, B, V2, U5, UV;
2757 int Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15;
2758 unsigned int size = width * height;
2759 unsigned char *iV = yuv + size;
2760 unsigned char *iU = yuv + 17 * size / 16;
2761 for (
unsigned int i = 0; i < height / 4; i++) {
2762 for (
unsigned int j = 0; j < width / 4; j++) {
2763 U = (int)((*iU++ - 128) * 0.354);
2765 V = (int)((*iV++ - 128) * 0.707);
2772 yuv = yuv + width - 3;
2777 yuv = yuv + width - 3;
2782 yuv = yuv + width - 3;
2787 yuv = yuv - 3 * width + 1;
2811 *rgb++ = (
unsigned char)R;
2812 *rgb++ = (
unsigned char)G;
2813 *rgb++ = (
unsigned char)B;
2834 *rgb++ = (
unsigned char)R;
2835 *rgb++ = (
unsigned char)G;
2836 *rgb++ = (
unsigned char)B;
2857 *rgb++ = (
unsigned char)R;
2858 *rgb++ = (
unsigned char)G;
2859 *rgb++ = (
unsigned char)B;
2880 *rgb++ = (
unsigned char)R;
2881 *rgb++ = (
unsigned char)G;
2882 *rgb = (
unsigned char)B;
2883 rgb = rgb + 3 * width - 11;
2903 *rgb++ = (
unsigned char)R;
2904 *rgb++ = (
unsigned char)G;
2905 *rgb++ = (
unsigned char)B;
2926 *rgb++ = (
unsigned char)R;
2927 *rgb++ = (
unsigned char)G;
2928 *rgb++ = (
unsigned char)B;
2949 *rgb++ = (
unsigned char)R;
2950 *rgb++ = (
unsigned char)G;
2951 *rgb++ = (
unsigned char)B;
2972 *rgb++ = (
unsigned char)R;
2973 *rgb++ = (
unsigned char)G;
2974 *rgb = (
unsigned char)B;
2975 rgb = rgb + 3 * width - 11;
2995 *rgb++ = (
unsigned char)R;
2996 *rgb++ = (
unsigned char)G;
2997 *rgb++ = (
unsigned char)B;
3018 *rgb++ = (
unsigned char)R;
3019 *rgb++ = (
unsigned char)G;
3020 *rgb++ = (
unsigned char)B;
3041 *rgb++ = (
unsigned char)R;
3042 *rgb++ = (
unsigned char)G;
3043 *rgb++ = (
unsigned char)B;
3064 *rgb++ = (
unsigned char)R;
3065 *rgb++ = (
unsigned char)G;
3066 *rgb = (
unsigned char)B;
3067 rgb = rgb + 3 * width - 11;
3087 *rgb++ = (
unsigned char)R;
3088 *rgb++ = (
unsigned char)G;
3089 *rgb++ = (
unsigned char)B;
3110 *rgb++ = (
unsigned char)R;
3111 *rgb++ = (
unsigned char)G;
3112 *rgb++ = (
unsigned char)B;
3133 *rgb++ = (
unsigned char)R;
3134 *rgb++ = (
unsigned char)G;
3135 *rgb++ = (
unsigned char)B;
3156 *rgb++ = (
unsigned char)R;
3157 *rgb++ = (
unsigned char)G;
3158 *rgb++ = (
unsigned char)B;
3159 rgb = rgb - 9 * width + 1;
3204 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3207 unsigned char *src = (flip) ? (rgb + (width * height * 3) + lineStep) : rgb;
3212 for (i = 0; i < height; i++) {
3213 unsigned char *line = src;
3214 for (j = 0; j < width; j++) {
3215 *rgba++ = *(line++);
3216 *rgba++ = *(line++);
3217 *rgba++ = *(line++);
3240 SimdBgraToBgr(rgba, size, 1, size * 4, rgb, size * 3);
3277 SimdRgbToGray(rgb, width, height, width * 3, grey, width);
3282 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3285 unsigned char *src = (flip) ? rgb + (width * height * 3) + lineStep : rgb;
3292 for (i = 0; i < height; i++) {
3293 unsigned char *line = src;
3294 for (j = 0; j < width; j++) {
3298 *grey++ = (
unsigned char)(0.2126 * r + 0.7152 * g + 0.0722 * b);
3331 omp_set_num_threads(
static_cast<int>(nThreads));
3333 #pragma omp parallel for
3335 for (
int i = 0; i < static_cast<int>(height); i++) {
3336 SimdRgbaToGray(rgba + i * width * 4, width, 1, width * 4, grey + i * width, width);
3356 SimdRgbaToGray(rgba, size, 1, size * 4, grey, size);
3404 SimdGrayToBgr(grey, size, 1, size, rgb, size * 3);
3431 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3434 unsigned char *src = (flip) ? (bgr + (width * height * 3) + lineStep) : bgr;
3436 for (
unsigned int i = 0; i < height; i++) {
3437 unsigned char *line = src;
3438 for (
unsigned int j = 0; j < width; j++) {
3439 *rgba++ = *(line + 2);
3440 *rgba++ = *(line + 1);
3441 *rgba++ = *(line + 0);
3470 SimdBgraToRgba(bgra, width, height, width * 4, rgba, width * 4);
3475 int lineStep = (flip) ? -(
int)(width * 4) : (
int)(width * 4);
3478 unsigned char *src = (flip) ? (bgra + (width * height * 4) + lineStep) : bgra;
3480 for (
unsigned int i = 0; i < height; i++) {
3481 unsigned char *line = src;
3482 for (
unsigned int j = 0; j < width; j++) {
3483 *rgba++ = *(line + 2);
3484 *rgba++ = *(line + 1);
3485 *rgba++ = *(line + 0);
3486 *rgba++ = *(line + 3);
3521 omp_set_num_threads(
static_cast<int>(nThreads));
3523 #pragma omp parallel for
3525 for (
int i = 0; i < static_cast<int>(height); i++) {
3526 SimdBgrToGray(bgr + i * width * 3, width, 1, width * 3, grey + i * width, width);
3532 int lineStep = (flip) ? -(
int)(width * 3) : (
int)(width * 3);
3535 unsigned char *src = (flip) ? bgr + (width * height * 3) + lineStep : bgr;
3537 for (
unsigned int i = 0; i < height; i++) {
3538 unsigned char *line = src;
3539 for (
unsigned int j = 0; j < width; j++) {
3540 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3575 omp_set_num_threads(
static_cast<int>(nThreads));
3577 #pragma omp parallel for
3579 for (
int i = 0; i < static_cast<int>(height); i++) {
3580 SimdBgraToGray(bgra + i * width * 4, width, 1, width * 4, grey + i * width, width);
3586 int lineStep = (flip) ? -(
int)(width * 4) : (
int)(width * 4);
3589 unsigned char *src = (flip) ? bgra + (width * height * 4) + lineStep : bgra;
3591 for (
unsigned int i = 0; i < height; i++) {
3592 unsigned char *line = src;
3593 for (
unsigned int j = 0; j < width; j++) {
3594 *grey++ = (
unsigned char)(0.2126 * *(line + 2) + 0.7152 * *(line + 1) + 0.0722 * *(line + 0));
3607 void vpImageConvert::computeYCbCrLUT()
3609 if (YCbCrLUTcomputed ==
false) {
3614 int aux = index - 128;
3615 vpImageConvert::vpCrr[index] = (int)(364.6610 * aux) >> 8;
3616 vpImageConvert::vpCgb[index] = (int)(-89.8779 * aux) >> 8;
3617 vpImageConvert::vpCgr[index] = (int)(-185.8154 * aux) >> 8;
3618 vpImageConvert::vpCbb[index] = (int)(460.5724 * aux) >> 8;
3621 YCbCrLUTcomputed =
true;
3650 unsigned char *pt_ycbcr = ycbcr;
3651 unsigned char *pt_rgb = rgb;
3655 vpImageConvert::computeYCbCrLUT();
3660 int val_r, val_g, val_b;
3666 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3667 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3668 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3670 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3672 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3673 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3674 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3709 unsigned char *pt_ycbcr = ycbcr;
3710 unsigned char *pt_rgba = rgba;
3714 vpImageConvert::computeYCbCrLUT();
3719 int val_r, val_g, val_b;
3725 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3726 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3727 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3729 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3731 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3732 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3733 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3761 unsigned int i = 0, j = 0;
3763 while (j < size * 2) {
3764 grey[i++] = ycbcr[j];
3765 grey[i++] = ycbcr[j + 2];
3795 unsigned char *pt_ycbcr = ycrcb;
3796 unsigned char *pt_rgb = rgb;
3800 vpImageConvert::computeYCbCrLUT();
3805 int val_r, val_g, val_b;
3811 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3812 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3813 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3815 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3817 *pt_rgb++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3818 *pt_rgb++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3819 *pt_rgb++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3853 unsigned char *pt_ycbcr = ycrcb;
3854 unsigned char *pt_rgba = rgba;
3858 vpImageConvert::computeYCbCrLUT();
3863 int val_r, val_g, val_b;
3869 val_r = *pt_ycbcr + vpImageConvert::vpCrr[*crv];
3870 val_g = *pt_ycbcr + vpImageConvert::vpCgb[*cbv] + vpImageConvert::vpCgr[*crv];
3871 val_b = *pt_ycbcr + vpImageConvert::vpCbb[*cbv];
3873 vpDEBUG_TRACE(5,
"[%d] R: %d G: %d B: %d\n", size, val_r, val_g, val_b);
3875 *pt_rgba++ = (val_r < 0) ? 0u : ((val_r > 255) ? 255u : (
unsigned char)val_r);
3876 *pt_rgba++ = (val_g < 0) ? 0u : ((val_g > 255) ? 255u : (
unsigned char)val_g);
3877 *pt_rgba++ = (val_b < 0) ? 0u : ((val_b > 255) ? 255u : (
unsigned char)val_b);
3939 unsigned char *ptrR = pR ? pR->
bitmap :
new unsigned char[src.
getSize()];
3940 unsigned char *ptrG = pG ? pG->
bitmap :
new unsigned char[src.
getSize()];
3941 unsigned char *ptrB = pB ? pB->
bitmap :
new unsigned char[src.
getSize()];
3942 unsigned char *ptrA = pa ? pa->
bitmap :
new unsigned char[src.
getSize()];
3977 std::map<unsigned int, unsigned int> mapOfWidths, mapOfHeights;
3998 if (mapOfWidths.size() == 1 && mapOfHeights.size() == 1) {
3999 unsigned int width = mapOfWidths.begin()->first;
4000 unsigned int height = mapOfHeights.begin()->first;
4002 RGBa.
resize(height, width);
4004 if (R != NULL && G != NULL && B != NULL && a != NULL) {
4005 SimdInterleaveBgra(R->
bitmap, width, G->
bitmap, width, B->
bitmap, width, a->
bitmap, width, width, height,
4006 reinterpret_cast<uint8_t *
>(RGBa.
bitmap), width *
sizeof(
vpRGBa));
4009 unsigned int size = width * height;
4010 for (
unsigned int i = 0; i < size; i++) {
4046 int i = (((int)size) << 1) - 1;
4047 int j = (int)size - 1;
4050 int y = grey16[i--];
4051 grey[j--] =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4068 int i = (((int)size) << 1) - 1;
4069 int j = (int)(size * 4 - 1);
4072 int y = grey16[i--];
4073 unsigned char v =
static_cast<unsigned char>((y + (grey16[i--] << 8)) >> 8);
4091 void vpImageConvert::HSV2RGB(
const double *hue_,
const double *saturation_,
const double *value_,
unsigned char *rgb,
4092 unsigned int size,
unsigned int step)
4094 for (
unsigned int i = 0; i < size; i++) {
4095 double hue = hue_[i], saturation = saturation_[i], value = value_[i];
4097 if (
vpMath::equal(saturation, 0.0, std::numeric_limits<double>::epsilon())) {
4102 double h = hue * 6.0;
4103 double s = saturation;
4106 if (
vpMath::equal(h, 6.0, std::numeric_limits<double>::epsilon())) {
4110 double f = h - (int)h;
4111 double p = v * (1.0 - s);
4112 double q = v * (1.0 - s * f);
4113 double t = v * (1.0 - s * (1.0 - f));
4155 rgb[i * step + 1] = (
unsigned char)
vpMath::round(saturation * 255.0);
4156 rgb[i * step + 2] = (
unsigned char)
vpMath::round(value * 255.0);
4172 void vpImageConvert::RGB2HSV(
const unsigned char *rgb,
double *hue,
double *saturation,
double *value,
4173 unsigned int size,
unsigned int step)
4175 for (
unsigned int i = 0; i < size; i++) {
4176 double red, green, blue;
4180 red = rgb[i * step] / 255.0;
4181 green = rgb[i * step + 1] / 255.0;
4182 blue = rgb[i * step + 2] / 255.0;
4185 max = ((std::max))(red, blue);
4186 min = ((std::min))(green, blue);
4189 max = ((std::max))(green, blue);
4190 min = ((std::min))(red, blue);
4195 if (!
vpMath::equal(max, 0.0, std::numeric_limits<double>::epsilon())) {
4196 s = (max - min) / max;
4202 if (
vpMath::equal(s, 0.0, std::numeric_limits<double>::epsilon())) {
4206 double delta = max - min;
4207 if (
vpMath::equal(delta, 0.0, std::numeric_limits<double>::epsilon())) {
4211 if (
vpMath::equal(red, max, std::numeric_limits<double>::epsilon())) {
4212 h = (green - blue) / delta;
4214 else if (
vpMath::equal(green, max, std::numeric_limits<double>::epsilon())) {
4215 h = 2 + (blue - red) / delta;
4218 h = 4 + (red - green) / delta;
4251 vpImageConvert::HSV2RGB(hue, saturation, value, rgba, size, 4);
4267 unsigned char *rgba,
unsigned int size)
4269 for (
unsigned int i = 0; i < size; i++) {
4270 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4291 vpImageConvert::RGB2HSV(rgba, hue, saturation, value, size, 4);
4306 unsigned char *value,
unsigned int size)
4308 for (
unsigned int i = 0; i < size; i++) {
4312 hue[i] = (
unsigned char)(255.0 * h);
4313 saturation[i] = (
unsigned char)(255.0 * s);
4314 value[i] = (
unsigned char)(255.0 * v);
4331 vpImageConvert::HSV2RGB(hue, saturation, value, rgb, size, 3);
4345 unsigned char *rgb,
unsigned int size)
4347 for (
unsigned int i = 0; i < size; i++) {
4348 double h = hue[i] / 255.0, s = saturation[i] / 255.0, v = value[i] / 255.0;
4368 vpImageConvert::RGB2HSV(rgb, hue, saturation, value, size, 3);
4382 unsigned char *value,
unsigned int size)
4384 for (
unsigned int i = 0; i < size; i++) {
4389 hue[i] = (
unsigned char)(255.0 * h);
4390 saturation[i] = (
unsigned char)(255.0 * s);
4391 value[i] = (
unsigned char)(255.0 * v);
4410 unsigned int height,
unsigned int nThreads)
4412 demosaicBGGRToRGBaBilinearTpl(bggr, rgba, width, height, nThreads);
4428 unsigned int height,
unsigned int nThreads)
4430 demosaicBGGRToRGBaBilinearTpl(bggr, rgba, width, height, nThreads);
4446 unsigned int height,
unsigned int nThreads)
4448 demosaicGBRGToRGBaBilinearTpl(gbrg, rgba, width, height, nThreads);
4464 unsigned int height,
unsigned int nThreads)
4466 demosaicGBRGToRGBaBilinearTpl(gbrg, rgba, width, height, nThreads);
4482 unsigned int height,
unsigned int nThreads)
4484 demosaicGRBGToRGBaBilinearTpl(grbg, rgba, width, height, nThreads);
4500 unsigned int height,
unsigned int nThreads)
4502 demosaicGRBGToRGBaBilinearTpl(grbg, rgba, width, height, nThreads);
4518 unsigned int height,
unsigned int nThreads)
4520 demosaicRGGBToRGBaBilinearTpl(rggb, rgba, width, height, nThreads);
4536 unsigned int height,
unsigned int nThreads)
4538 demosaicRGGBToRGBaBilinearTpl(rggb, rgba, width, height, nThreads);
4556 unsigned int height,
unsigned int nThreads)
4558 demosaicBGGRToRGBaMalvarTpl(bggr, rgba, width, height, nThreads);
4574 unsigned int height,
unsigned int nThreads)
4576 demosaicBGGRToRGBaMalvarTpl(bggr, rgba, width, height, nThreads);
4592 unsigned int height,
unsigned int nThreads)
4594 demosaicGBRGToRGBaMalvarTpl(gbrg, rgba, width, height, nThreads);
4610 unsigned int height,
unsigned int nThreads)
4612 demosaicGBRGToRGBaMalvarTpl(gbrg, rgba, width, height, nThreads);
4628 unsigned int height,
unsigned int nThreads)
4630 demosaicGRBGToRGBaMalvarTpl(grbg, rgba, width, height, nThreads);
4646 unsigned int height,
unsigned int nThreads)
4648 demosaicGRBGToRGBaMalvarTpl(grbg, rgba, width, height, nThreads);
4664 unsigned int height,
unsigned int nThreads)
4666 demosaicRGGBToRGBaMalvarTpl(rggb, rgba, width, height, nThreads);
4682 unsigned int height,
unsigned int nThreads)
4684 demosaicRGGBToRGBaMalvarTpl(rggb, rgba, width, height, nThreads);
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
@ 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 threshold=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.