webcam
Connection to a webcam
Add-On Required: This feature requires the MATLAB Support Package for USB Webcams add-on.
Description
A webcam
object represents a connection to a webcam. Use the
webcam
function to establish a connection with a webcam on your system
and acquire images from it. After you create the object, you can access images using the Object Functions.
Creation
Description
cam = webcam
creates the webcam
object
cam
and connects to the single webcam on your system. If you have
multiple cameras and you use the webcam
function with no input
argument, it creates the object and connects it to the first camera it finds listed in the
output of the webcamlist
function.
When the webcam
object is created, it connects to the camera,
establishes exclusive access, and starts streaming data. You can then preview the data and
acquire images using the snapshot
function.
cam = webcam(
creates a
devicenumber
)webcam
object cam
where
devicenumber
is a numeric scalar value that identifies a particular
webcam by its index number. When you use the webcam
function with an
index as the input argument, it creates the object corresponding to that index and
connects it to that camera.
cam = webcam('
creates a
cameraname
')webcam
object cam
where
cameraname
is a character vector value that identifies a particular
webcam by its name. When you use the webcam
function with the name of
the camera as the input argument, it creates the object and connects it to the camera with
that name.
Input Arguments
Properties
Object Functions
closePreview | Close webcam preview window |
preview | Preview live video data from webcam |
snapshot | Acquire single image frame from a webcam |
Examples
Version History
Introduced in R2014a