mirror of
https://github.com/opencv/opencv.git
synced 2024-11-25 19:50:38 +08:00
Merge pull request #15001 from antmicro:v4l2-y10-support
This commit is contained in:
commit
3c086fb2fe
@ -496,7 +496,8 @@ bool CvCaptureCAM_V4L::autosetup_capture_mode_v4l2()
|
||||
V4L2_PIX_FMT_JPEG,
|
||||
#endif
|
||||
V4L2_PIX_FMT_Y16,
|
||||
V4L2_PIX_FMT_GREY
|
||||
V4L2_PIX_FMT_Y10,
|
||||
V4L2_PIX_FMT_GREY,
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(try_order) / sizeof(__u32); i++) {
|
||||
@ -543,6 +544,7 @@ bool CvCaptureCAM_V4L::convertableToRgb() const
|
||||
case V4L2_PIX_FMT_SGBRG8:
|
||||
case V4L2_PIX_FMT_RGB24:
|
||||
case V4L2_PIX_FMT_Y16:
|
||||
case V4L2_PIX_FMT_Y10:
|
||||
case V4L2_PIX_FMT_GREY:
|
||||
case V4L2_PIX_FMT_BGR24:
|
||||
return true;
|
||||
@ -577,6 +579,7 @@ void CvCaptureCAM_V4L::v4l2_create_frame()
|
||||
size.height = size.height * 3 / 2; // "1.5" channels
|
||||
break;
|
||||
case V4L2_PIX_FMT_Y16:
|
||||
case V4L2_PIX_FMT_Y10:
|
||||
depth = IPL_DEPTH_16U;
|
||||
/* fallthru */
|
||||
case V4L2_PIX_FMT_GREY:
|
||||
@ -1451,6 +1454,13 @@ void CvCaptureCAM_V4L::convertToRgb(const Buffer ¤tBuffer)
|
||||
cv::cvtColor(temp, destination, COLOR_GRAY2BGR);
|
||||
return;
|
||||
}
|
||||
case V4L2_PIX_FMT_Y10:
|
||||
{
|
||||
cv::Mat temp(imageSize, CV_8UC1, buffers[MAX_V4L_BUFFERS].start);
|
||||
cv::Mat(imageSize, CV_16UC1, currentBuffer.start).convertTo(temp, CV_8U, 1.0 / 4);
|
||||
cv::cvtColor(temp, destination, COLOR_GRAY2BGR);
|
||||
return;
|
||||
}
|
||||
case V4L2_PIX_FMT_GREY:
|
||||
cv::cvtColor(cv::Mat(imageSize, CV_8UC1, currentBuffer.start), destination, COLOR_GRAY2BGR);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user