Capture video using either the front or rear camera


The R, G, and B ports each outputs an image as a matrix of uint8 values.

During simulations without hardware, this block outputs zeros. See Block Produces Zeros or Does Nothing in Simulation (Simulink).

Dialog Box

Target hardware

The Target hardware should match the value of the Hardware board set in the Hardware Implementation pane of the Configuration Parameters dialog box. The Configuration Parameters dialog box can be accessed from Simulation > Model Configuration Parameters in the menu bar of the Simulink® Editor window.

Camera location

Select one of the two cameras:

  • Front uses the camera on the same side as the display.

  • Back uses the camera on the opposite side from the display.

Image size

Select one of the image sizes.

Image size significantly affects the rate at which the camera produces data. For example, capturing video at 1920x1080 produces almost six times more data than capturing video at 720x486.

During External mode, you cannot tune the value of this parameter.

Sample time

Specify how often the block reads the sensor.

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

Introduced in R2015a