webcam
Create connection to Raspberry Pi web camera
Syntax
Description
allows you to select the camera specified by wcam
= webcam(mypi
, cameraName
)cameraName
. Use this
syntax when you have more than one camera connected to the Raspberry Pi
hardware.
allows you to select the camera specified by wcam
= webcam(mypi
, cameraIndex
)cameraIndex
. Use
this syntax when you have more than one camera connected to the Raspberry Pi
hardware.
allows you to select the dimensions of the image taken by the camera connected to
the Raspberry Pi hardware.wcam
= webcam(mypi
, cameraName
, resolution
)
Input Arguments
Output Arguments
Properties
Examples
Use the Web Camera
You can connect from the MATLAB software to the USB web camera connected to Raspberry Pi board and take a photograph.
Create a connection from the MATLAB to the Raspberry Pi board. If you encounter errors after running the above command, try
using additional arguments (as listed in raspi
) or refer to Troubleshoot Connecting Issues to Raspberry Pi Hardware.
mypi = raspi;
Create a connection from the MATLAB software to the Raspberry Pi hardware.
mypi = raspi;
Create a connection, wcam
, from the MATLAB software to the USB web camera connected to the Raspberry Pi board,
and set the image resolution. The connection displays the web camera
properties.
wcam = webcam(mypi)
wcam = webcam with properties: Name: "/dev/video0" Resolution: "320x240" AvailableResolutions: {"320x240" "640x480"}
Import and display a sequence of 10 snapshots on your host computer.
for ii = 1:10 img = snapshot(wcam); imagesc(img) drawnow end