Documentation

Use Camera Board with V4L2 Video Capture Block

The following instructions show how to enable Raspberry Pi™ Camera Board as an input device for the V4L2 Video Capture block.

In the MATLAB® Command Window, enter:

mypi = raspi
system(mypi,'sudo modprobe bcm2835-v4l2')
system(mypi,'ls -al /dev/vid*')
ans =

crw-rw---T+ 1 root video 81, 0 Jul 16 17:26 /dev/video0

These commands connect to the board, load the V4L2 driver for the Raspberry Pi Camera, and checks that the video device has been created.

Then, configure the V4L2 Video Capture block to use this video device.

Rebooting the Raspberry Pi board discards the video device. Therefore, repeat this procedure after each reboot, or add a line, sudo modprobe bcm2835-v4l2, to the /etc/rc.local startup script that Raspberry Pi board runs when it boots up.

Was this topic helpful?