Inlab Scheme’s b4l2 interface supports USB cameras which offer YUYV 4:2:2 format (which all recent models do). Older cameras which can only deliver single JPEG compressed frames are no longer supported.
To get a list of available devices and formats execute the v4l2-ctl command with the –list-formats-ext option. Here’s an example of a specific no-name camera module on a Raspberry Pi:
$ v4l2-ctl --list-formats-ext -d /dev/video0 ioctl: VIDIOC_ENUM_FMT Type: Video Capture : 'YUYV' (YUYV 4:2:2) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 352x288 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 320x240 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 176x144 Interval: Discrete 0.033s (30.000 fps) Size: Discrete 160x120 Interval: Discrete 0.033s (30.000 fps)
The currently available / connected camera devices can be shown with v4l2-ctl as shown below (Example). Multiple /dev/videoX entries per camera may offer different capabilities, in practice usually only the first one is referenced and used. The so called “media node” is also not needed for capturing image frames.
$ v4l2-ctl --list-devices Chicony USB 2.0 Camera: Chicony (usb-0000:00:14.0-6): /dev/video0 /dev/video1 /dev/media0 HD USB Camera: HD USB Camera (usb-0000:00:14.0-7): /dev/video2 /dev/video3 /dev/media1
On the Raspberry Pi it’s currectly necessary to start the uvcvideo module with the quirks=0x80 option. This avoids an annoying select-timeout error. Here’s a tiny script which activates this non permanently:
#!/bin/bash rmmod uvcvideo modprobe uvcvideo nodrop=1 timeout=5000 quirks=0x80
(v4l2-grab-bitmap) returns a bitmap from the v4l2 device with the current active dimensions. The v4l2 device needs to be open and ready for use (a successful (v4l2-open) needs to be executed before). This procedure is defined as follows:
 (pp v4l2-grab-bitmap) (lambda () (greymap->bitmap (v4l2-grab-greymap))) ok