Main Content

webcam

Connection to web camera on BeagleBone Black hardware

Add-On Required: This feature requires the MATLAB Support Package for BeagleBone Black Hardware add-on.

Description

This object represents a connection from the MATLAB® software to a web camera on the BeagleBone® Black hardware. To configure the web camera settings, use the object properties listed in Properties. To interact with the web camera, use this object with the functions listed in Object Functions.

Creation

Description

wcam = webcam(bbb) creates a connection from the MATLAB software to a web camera that is attached to the BeagleBone Black hardware. You can capture video and still images by using this webcam object with the snapshot function.

example

wcam = webcam(bbb,cameraName) creates a connection from the MATLAB software to the web camera, specified by name, that is attached the BeagleBone Black hardware. Use this syntax when more than one camera is connected to the hardware.

example

wcam = webcam(bbb,cameraIndex) creates a connection from the MATLAB software to the web camera, specified by numerical index, that is attached the BeagleBone Black hardware. Use this syntax when more than one camera is connected to the hardware.

example

wcam = webcam(bbb,cameraName,resolution) creates a connection from the MATLAB software to the specified web camera that is attached the BeagleBone Black hardware. Use this syntax when more than one camera is connected to the hardware. Specify the dimensions of the image to be captured by the specified camera.

example

Input Arguments

expand all

BeagleBone Black connection created using beaglebone, specified as an object.

The name of the camera that is attached to the BeagleBone Black hardware.

The numerical index of the camera that is attached to the BeagleBone Black hardware.

Properties

expand all

This property is read-only.

The dimensions of the image to be taken by the camera that is attached to the BeagleBone Black hardware.

Use the AvailableResolutions property of the webcam object to get a list of resolutions that the camera supports.

Example: '640x480'

Data Types: char

This property is read-only.

The list of resolutions that the camera supports.

Example: {'320x240' '640x480'}

Data Types: char

Object Functions

snapshotCapture RGB image from web camera

Examples

collapse all

You can connect to the web camera from the MATLAB software and take a photograph.

Create a connection from the MATLAB software to the BeagleBone Black hardware.

bbb = beaglebone

Create a connection, wcam, from the MATLAB software to the web camera, and set the image resolution. The connection displays the web camera properties.

wcam = webcam(bbb)
wcam = 

  webcam with properties:

                    Name: '/dev/video0'
              Resolution: '320x240'
    AvailableResolutions: {'320x240'  '640x480'}

Import and display a sequence of 10 snapshots on your computer.

for ii = 1:10
img = snapshot(wcam)
    imagesc(img)
    drawnow
end

Version History

Introduced in R2015a