MATLAB编程->MATLAB2014a的webcam操作
来源:程序员人生 发布时间:2014-10-09 06:15:57 阅读次数:3068次
由于MATLAB2014a安装的是免费版,在用videoinput时便出现问题如下:
imaqhwinfo
警告: No Image Acquisition adaptors found. Image acquisition adaptors may be available as downloadable support packages. Open Support
Package Installer to install additional vendors.
ans =
InstalledAdaptors: {}
MATLABVersion: '8.3 (R2014a)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '4.7 (R2014a)'
于是安装webcam来解决读取摄像头问题:
点击:Get Hardware Support Packages
出现以上的界面,点击USB Webcams 安装。
安装后:
help webcam
webcam 的内容:
webcam - Creates webcam object to acquire frames from your Webcam.
Webcam support.
Webcam functions.
webcam - Creates webcam object to acquire frames from your webcam.
webcamlist - Returns a list of all webcams connected to the system.
webcam 既是目录也是函数。
webcam Creates webcam object to acquire frames from your Webcam.
CAMOBJ = webcam returns a webcam object, CAMOBJ, that acquires images
from the specified Webcam. By default, this selects the first
available Webcam returned by WEBCAMLIST.
CAMOBJ = webcam(DEVICENAME) returns a webcam object, CAMOBJ, for
Webcam with the specified name, DEVICENAME. The Webcam name can be
found using the function WEBCAMLIST.
CAMOBJ = webcam(DEVICEINDEX) returns a webcam object, CAMOBJ, for
Webcam with the specified device index, DEVICEINDEX. The Webcam device
index is the index into the cell array returned by WEBCAMLIST.
CAMOBJ = webcam(..., P1, V1, P2, V2,...) constructs the webcam object,
CAMOBJ, with the specified property values. If an invalid property
name or property value is specified, the webcam object is not created.
Creating webcam object obtains exclusive access to the Webcam.
SNAPSHOT method syntax:
IMG = snapshot(CAMOBJ) acquires a single frame from the Webcam.
[IMG, TIMESTAMP] = snapshot(CAMOBJ) returns the frame, IMG, and the
acquisition timestamp, TIMESTAMP.
webcam methods:
snapshot - Acquire a single frame from the Webcam.
preview - Activate a live image preview window.
closePreview - Close live image preview window.
webcam properties:
Name - Name of the Webcam.
Resolution - Resolution of the acquired frame.
AvailableResolutions - Cell array of list of available resolutions.
The webcam interface also exposes the dynamic properties of the Webcam
that we can access programmatically. Some of these dynamic properties
are Brightness, Contrast, Hue, Exposure etc. The presence of these
properties in the webcam object depends on the Webcam that you connect
to.
Example:
% Construct a webcam object
camObj = webcam;
% Preview a stream of image frames.
preview(camObj);
% Acquire and display a single image frame.
img = snapshot(camObj);
image(img);
See also webcamlist
根据help来看:
至此调用成功。
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠