如何在MJPG opencv捕捉摄像头的video

我已经买了两台Genius facecam 1000x摄像机,并试图build立一个立体摄像机,摄像机的v4l2-ctl输出如下:

 ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2 Index : 1 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : Motion-JPEG 

正如你所看到的像素格式MJPG是支持的,从这个这个像素格式是必要的,但是当我尝试从两个摄像头捕获videoVIDIOC_STREAMON: No space left on device错误仍然发生的第二个相机,我只能以320×240分辨率获得立体声video! 我尝试了以下两个,但不适合我。

  1. v4l2-ctl --set-fmt-video=width=640,height=480,pixelformat=1
  2. FOURCC设置为MJPG会导致HIGHGUI ERROR: V4L: Property <unknown property string>(6) not supported by device错误HIGHGUI ERROR: V4L: Property <unknown property string>(6) not supported by device

     # setting the `FOURCC` will cause the # `HIGHGUI ERROR: V4L: Property <unknown property string>(6) not supported by device` for p in ports: self.caps.append(cv2.VideoCapture(p)) self.caps[-1].set(cv2.cv.CV_CAP_PROP_FOURCC('M','J','P','G')); 

我该怎么做才能在相对可靠的解决scheme中做到这一点?

PS:我所有的USB端口都连接到一个控制器!

Solutions Collecting From Web of "如何在MJPG opencv捕捉摄像头的video"