opencvv4l2v4l

OpenCV is able to change to composite input?


I would like to know if OpenCV is able to set the camera (dev/video1) to composite or S-video input.

The camera I was using only runs in composite input, but v4l2 opens dev/video1 in S-Video input by default. V4l2 is able to change from S-video to composite input by QT V4l2 utils application.

The opencv is using v4l to capture imagens from camera, and I want to change to composite input in code using OpenCV. Is that possible? If it's not, what is the solution to this?

Thanks in advance.


Solution

  • You have just to change the input with "v4l2-ctl" ! For example, I use Python on my raspberry to capture the video stream from S-Video with OpenCV :

        import cv, os
    
        print "Initializing video capture from /dev/video0 ..."
        capture = cv.CaptureFromCAM(0)
        cv.SetCaptureProperty(capture,cv.CV_CAP_PROP_FRAME_WIDTH, 720)
        cv.SetCaptureProperty(capture,cv.CV_CAP_PROP_FRAME_HEIGHT, 576)
    
        print "Configuring video capture (V4L2) ..."
        os.system("v4l2-ctl -d /dev/video0 -i 5 -s 4 --set-fmt-video=width=720,height=576,pixelformat=4")
    

    With :