Main Content

V4L2 Video Capture

Capture video from USB camera using V4L2

Add-On Required: This feature requires the Simulink Coder Support Package for Beaglebone Blue Hardware add-on.

  • V4L2 Video Capture block

Libraries:
Simulink Coder Support Package for BeagleBone Blue Hardware / Video

Description

Capture live video from a USB video camera, using the V4L2 (Video for Linux Two API) driver framework. The output is in row major format. During simulation, the model outputs a moving colorbar image.

The Ubuntu® Linux® image used on the target hardware supports video capture from USB cameras listed as Universal Video Class (UVC). In addition to being a UVC class camera, the camera itself must support data acquisition in YUYV mode.

The following cameras have been tested:

  • Logitech QuickCam Pro 9000

  • Logitech QuickCam Pro 3000

  • Logitech Webcam C600

  • Logitech HD Webcam C310

Ports

Output

expand all

This port outputs the red component of each pixel.

Dependencies

This port appears only when you select the RGB from Pixel format.

Data Types: uint8

This port outputs the green component of each pixel.

Dependencies

This port appears only when you select the RGB from Pixel format.

Data Types: uint8

This port outputs the blue component of each pixel.

Dependencies

This port appears only when you select the RGB from Pixel format.

Data Types: uint8

This port outputs the luma component of each pixel.

Dependencies

This port appears only when you select the YCbCr 4:2:2 from Pixel format.

Data Types: uint8

This port outputs the blue difference component of each pixel.

Dependencies

This port appears only when you select the YCbCr 4:2:2 from Pixel format.

Data Types: uint8

This port outputs the red difference component of each pixel.

Dependencies

This port appears only when you select the YCbCr 4:2:2 from Pixel format.

Data Types: uint8

Parameters

expand all

Enter the path and name of the video device.

The Linux kernel creates a video device file when you connect a supported USB video camera to the target hardware. By default, the Linux kernel supports all USB video class (UVC) devices.

To see the list of video device files, open a command line session with the target hardware and enter: ls -al /dev/video*.

Specify the display resolution of the image to be captured, in pixels.

Specify the width in pixels and height in lines of the image to be captured.

Dependencies

This parameter appears only when you select Custom from Image Size.

Select the video format of the video device, RGB or YCbCr 4:2:2.

RGB represents the red, green, and blue components of a pixel using an 8-bit value. RGB color space is device-dependent.

YCbCr 4:2:2 uses three channels to represent color image data for each pixel:

  • Y is the luma component (essentially a grayscale signal).

  • Cb is the blue-difference chroma component.

  • Cr is the red-difference chroma component.

The Cb and Cr components are sampled at half the sample rate of Y.

Select the sample time of the video device.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

Version History

Introduced in R2018b