Search code examples
c++opencvimage-processingvideo-captureyuv

How can i convert YUV into BGR in OpenCV when i use a video capture card


we are using a capture card named AVerMedia CV710. When the official software was used, the video we obtained was nice. But We wanna develop the video by Opencv, via the func. "VideoCapture capture.open(0)" the video is as follow: enter image description here the Chroma Subsampling of CV710 is YUV4:2:2. So what should we do to get the nice video. Maybe the DirectShow or something else?


Solution

  • First of all, i think you should check if your camera stream can be decoded and displayed in the right way using AmCap.

    In fact, OpenCV itself use directshow to decode the video stream. Though, it seems the stream is not decoded in the right way in your case.

    The directshow graphic used in opencv is like this

    CAMERA --> SampleGrabber --> NullRender

    You need to add a transform filter between CAMERA and SampleGrabber to transter the YUV stream to RGB data.