Main Content


Capture video using front or rear camera

Add-On Required: This feature requires the Simulink Support Package for Android Devices add-on.

  • Camera block

Simulink Support Package for Android Devices / Audio & Video


Capture video from the front or rear camera on the Android™ device.

The Camera block has three output ports: R, G, and B. Each port outputs a 2–dimensional matrix of uint8 values. Together, these matrices make up the color image from the camera. The Resolution parameter determines the matrix dimensions.


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



Select the camera location on the device and the size of image.

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

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

To get a list of device specific Resolution, connect your configured device and press the Refresh button. To configure your device, follow the instructions provided during the Hardware Setup process.

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.

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.

Version History

Introduced in R2014a