mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 11:40:44 +08:00
replace rgb24_to_rgb24 by tested cvtColor
internally using ipp this conversion is now roughly 2x faster. also add RGB/ BGR formats to allowed zero copy access.
This commit is contained in:
parent
f50817120e
commit
8527d895bb
@ -558,6 +558,9 @@ static int v4l2_num_channels(__u32 palette) {
|
|||||||
case V4L2_PIX_FMT_YUYV:
|
case V4L2_PIX_FMT_YUYV:
|
||||||
case V4L2_PIX_FMT_UYVY:
|
case V4L2_PIX_FMT_UYVY:
|
||||||
return 2;
|
return 2;
|
||||||
|
case V4L2_PIX_FMT_BGR24:
|
||||||
|
case V4L2_PIX_FMT_RGB24:
|
||||||
|
return 3;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1366,16 +1369,10 @@ static void sgbrg2rgb24(long int WIDTH, long int HEIGHT, unsigned char *src, uns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static inline void
|
||||||
rgb24_to_rgb24 (int width, int height, unsigned char *src, unsigned char *dst)
|
rgb24_to_rgb24 (int width, int height, unsigned char *src, unsigned char *dst)
|
||||||
{
|
{
|
||||||
const int size = width * height;
|
cvtColor(Mat(height, width, CV_8UC3, src), Mat(height, width, CV_8UC3, dst), COLOR_RGB2BGR);
|
||||||
for(int i = 0; i < size; ++i, src += 3, dst += 3)
|
|
||||||
{
|
|
||||||
*(dst + 0) = *(src + 2);
|
|
||||||
*(dst + 1) = *(src + 1);
|
|
||||||
*(dst + 2) = *(src + 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CLAMP(x) ((x)<0?0:((x)>255)?255:(x))
|
#define CLAMP(x) ((x)<0?0:((x)>255)?255:(x))
|
||||||
|
Loading…
Reference in New Issue
Block a user