Create video input object
obj = videoinput(
adaptorname
)
obj = videoinput(adaptorname
,deviceID)
obj = videoinput(adaptorname
,deviceID,format
)
obj = videoinput(adaptorname
,deviceID,format
,P1,V1,...)
obj = videoinput(
constructs
the video input object adaptorname
)obj
. A video input object
represents the connection between MATLAB® and
a particular image acquisition device. adaptorname
is
a character vector that specifies the name of the adaptor used to
communicate with the device. Use the imaqhwinfo
function
to determine the adaptors available on your system.
obj = videoinput(
constructs
a video input object adaptorname
,deviceID)obj
, where deviceID
is
a numeric scalar value that identifies a particular device available
through the specified adaptor, adaptorname
.
Use the imaqhwinfo(
syntax
to determine the devices available through the specified adaptor.
If adaptorname
)deviceID
is not specified, the first available
device ID is used. As a convenience, a device's name can be used in
place of the deviceID
. If multiple devices have
the same name, the first available device is used.
obj = videoinput(
constructs
a video input object, where adaptorname
,deviceID,format
)format
is a
character vector that specifies a particular video format supported
by the device or the full path of a device configuration file (also
known as a camera file).
To get a list of the formats supported by a particular device,
view the DeviceInfo
structure for the device that
is returned by the imaqhwinfo
function. Each DeviceInfo
structure
contains a SupportedFormats
field. If format
is
not specified, the device's default format is used.
When the video input object is created, its VideoFormat
field
contains the format name or device configuration file that you specify.
obj = videoinput(
creates
a video input object adaptorname
,deviceID,format
,P1,V1,...)obj
with the specified property
values. If an invalid property name or property value is specified,
the object is not created.
The property name and property value pairs can be in any format
supported by the set
function, i.e., parameter/value
character vector pairs, structures, or parameter/value cell array
pairs.
To view a complete listing of video input object functions and
properties, use the imaqhelp
function.
imaqhelp videoinput
In the documentation, see Image Acquisition Toolbox Properties for links to the property reference pages.
Construct a video input object.
obj = videoinput('matrox', 1);
Select the source to use for acquisition.
obj.SelectedSourceName = 'input1'
View the properties for the selected video source object.
src_obj = getselectedsource(obj); get(src_obj)
Preview a stream of image frames.
preview(obj);
Acquire and display a single image frame.
frame = getsnapshot(obj); image(frame);
Remove video input object from memory.
delete(obj);
The toolbox chooses the first available video source object
as the selected source and specifies this video source object's name
in the object's SelectedSourceName
property. Use getselectedsource(obj)
to
access the video source object that is used for acquisition.
Note
To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.