Help with video capturing for mjpg

Hello! New to this forum.

I am using two Arducam 2MP OV2710 to build a set of stereovision.
In the camera spec it says it supports MJPG or YUY2. The MJPG is more desirable since my project would need a good resolution to identify features for disparity generation.

It seems like the cv2.VideoCapture’s default data format is YUY2.

I would like some help regarding how to get MJPG input using opencv driver.

Thank you!

Opencv version = 4.7.0

[Doc is here
You have to change camera settings with an external program. Opencv does not not OV2710 camera

Opencv uses API to communicate with hardware. You can get api known

import cv2 as cv
print(cv.getBuildInformation())

In my configuration it is :

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES (prebuilt binaries)
      avcodec:                   YES (58.134.100)
      avformat:                  YES (58.76.100)
      avutil:                    YES (56.70.100)
      swscale:                   YES (5.9.100)
      avresample:                YES (4.0.0)
    GStreamer:                   NO
    DirectShow:                  YES
    Media Foundation:            YES
      DXVA:                      YES

as long as the operating system recognizes it (linux: V4L), it’ll be fine. check for the existence of /dev/video0.

just set the CAP_PROP_FOURCC property to VideoWriter_fourcc(*"MJPG")

… in the right sequence, if you set any other properties. try setting that first or last.

Thank you for the help! I appreciate it :slight_smile:

Got it! thank you for helping out! this works!
Adding to it, the Videocapture class have to be initialized using VideoCapture(index,cv2.CAP_V4L2), at least for me!

Thank you thank you.