Merge pull request #26081 from mshabunin:fix-v4l-nv12

videoio: fix V4L backend with NV12 input format
This commit is contained in:
Alexander Smorkalov 2024-08-28 18:46:53 +03:00 committed by GitHub
commit f156236d17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1538,11 +1538,11 @@ void CvCaptureCAM_V4L::convertToRgb(const Buffer &currentBuffer)
return; return;
case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12:
cv::cvtColor(cv::Mat(imageSize.height * 3 / 2, imageSize.width, CV_8U, start), destination, cv::cvtColor(cv::Mat(imageSize.height * 3 / 2, imageSize.width, CV_8U, start), destination,
COLOR_YUV2RGB_NV12); COLOR_YUV2BGR_NV12);
return; return;
case V4L2_PIX_FMT_NV21: case V4L2_PIX_FMT_NV21:
cv::cvtColor(cv::Mat(imageSize.height * 3 / 2, imageSize.width, CV_8U, start), destination, cv::cvtColor(cv::Mat(imageSize.height * 3 / 2, imageSize.width, CV_8U, start), destination,
COLOR_YUV2RGB_NV21); COLOR_YUV2BGR_NV21);
return; return;
#ifdef HAVE_JPEG #ifdef HAVE_JPEG
case V4L2_PIX_FMT_MJPEG: case V4L2_PIX_FMT_MJPEG: