V4L2_PIX_FMT_BGR24,
V4L2_PIX_FMT_RGB24,
V4L2_PIX_FMT_YVU420,
+ V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_YUV411P,
V4L2_PIX_FMT_YUYV,
V4L2_PIX_FMT_UYVY,
static int v4l2_num_channels(__u32 palette) {
switch(palette) {
case V4L2_PIX_FMT_YVU420:
+ case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_MJPEG:
case V4L2_PIX_FMT_JPEG:
case V4L2_PIX_FMT_Y16:
size = CvSize(capture->buffers[capture->bufferIndex].length, 1);
break;
case V4L2_PIX_FMT_YVU420:
+ case V4L2_PIX_FMT_YUV420:
size.height = size.height * 3 / 2; // "1.5" channels
break;
case V4L2_PIX_FMT_Y16:
/* Converts from planar YUV420P to RGB24. */
static inline void
-yuv420p_to_rgb24(int width, int height, uchar* src, uchar* dst)
+yuv420p_to_rgb24(int width, int height, uchar* src, uchar* dst, bool isYUV)
{
cvtColor(Mat(height * 3 / 2, width, CV_8U, src), Mat(height, width, CV_8UC3, dst),
- COLOR_YUV2BGR_YV12);
+ isYUV ? COLOR_YUV2BGR_IYUV : COLOR_YUV2BGR_YV12);
}
// Consider a YUV411P image of 8x2 pixels.
break;
case V4L2_PIX_FMT_YVU420:
+ case V4L2_PIX_FMT_YUV420:
yuv420p_to_rgb24(capture->form.fmt.pix.width,
capture->form.fmt.pix.height,
(unsigned char*)(capture->buffers[capture->bufferIndex].start),
- (unsigned char*)capture->frame.imageData);
+ (unsigned char*)capture->frame.imageData,
+ capture->palette == V4L2_PIX_FMT_YUV420);
break;
case V4L2_PIX_FMT_YUV411P: