I trying to use openCV/c++ to capture the left and right image from a LI-USB30_V024 stereo camera without automatically converting it to RGB. The camera outputs images in YUYV format.
I have tried using videoCapture.set(CV_CAP_PROP_CONVERT_RGB, false) but I get the message "HIGHGUI ERROR: V4L: Property (16) not supported by device".
The reason I want to avoid the conversion to RGB is because the camera packages the left and right video together in to a single YUYV image. Both cameras are monochrome, and as far as I can tell the left image information is encoded in the Y channels while the right image is encoded in the U and V channels. For example if I run guvcview I get a single image that contains both the left and right images superpositioned. It looks like a black and white image (the left image is encoded in the Y channels) with a green and pink image lying on top (the right camera is encoded in the UV channels). I know this sounds pretty unusual so if you have any other ideas/questions about it then don't hesitate.
My goal is to capture the image as YUYV so that I can use split() to separate the left image (Y channels) from the right image (U and V channels) and display them both as monochrome images. However, once the image has been converted to RGB the luminance and chominance channels get blended together and it becomes impossible to separate the two images.
To sum it up, I need to capture the video without converting it to RGB so that the YUYV format is preserved. This will allow me to separate the left and right images.
OR I need a way of capturing the left and right images separately, but I think this is unlikely.
I think this would be possible in v4l, but I would prefer to only use openCV if possible.
Thanks!
I dont think there is a way to do this in openCV. In the end it wasn't too much trouble to capture frames with V4L2 and store them in openCV Mats.
In header file videoio.hpp:
Usage:
I used to wrok on a camera which produce YUV420 data,and got some problem in configuring it. But this function works for me.
Can you check if there is any other configuration that cause the problem.