From USB Video Device

From USB Video Device block


Simulink® Real-Time™ Library for USB Camera


The From USB Video Device block enables you to acquire real-time video frames or still images from a USB Video Class (UVC) webcam. You attach the webcam to a USB port on the target computer. After you acquire the image, you can:

  • Display the output on the target computer monitor using a Video Display block.

  • Stream captured frames to the development computer display (for example, using the To Video Display block from Computer Vision System Toolbox™).

  • Analyze the image signals on the development computer.

  • Compress or decompress the input signal with the JPEG Compression or JPEG Decompression blocks.

When you add this block, also add the USB Video Device List block to help configure the webcam.

The Image signal setting determines the Image signal setting for blocks receiving this signal, such as the Video Display block.


When you execute a model containing a From USB Video Device block on a single-core target computer, insufficient time is sometimes available to process frames received through the USB port. Under these conditions, the block can drop frames. If the block is dropping frames, specify a larger frame interval, lengthen the sample time, or use a multicore target computer.

Block Parameters


Select a configuration that you specified in the USB Video Device List block. When you click the Reload Device List button on the USB Video Device List block, this configuration list is updated.

Port address (-1 for any)

Specify the port to which the webcam is attached. Enter -1 for any USB port.

Image width

Enter the width of the image input from the USB port, in pixels.

Image height

Enter the height of the image input from the USB port, in pixels.

Frame interval

Select the sample time between frame transfers:

  • 1/60

  • 1/30

  • 1/25

  • 1/20

  • 1/15

  • 1/10

  • 1/7.5

  • 1/5

Frame format

Select whether the incoming frames are to be compressed:

  • Uncompressed

    Do not compress frames.


    Compress frames using Motion JPEG format. Each frame is individually compressed as a JPEG image. Selecting this option disables the Color format and Image signal parameters.

Color format

Select the color format for the incoming frames:

  • RGB24 (8:8:8)

    Output frames using RGB24 color encoding.

  • YCbCr (4:2:2)

    Output frames using YCbCr color encoding.

Image signal
  • One multidimensional signal

    One signal where each dimension contains color information. Selecting this option creates one port, Image.

  • Separate color signals

    Multiple color signals where each signal contains the information for one color. Selecting this option creates the following ports, depending upon the colorspace.

    • RGB: ports R, G, B

    • YCbCr: ports Y, Cb, Cr

Show trigger input

Select this check box to display an input port, Trigger, for the block.

Show length output

Select this check box to display an output port, Length, for the block.

Introduced in R2011a

Was this topic helpful?