主要内容

确定可用的设备

这个例子展示了如何识别系统上可用的设备,获取设备信息。

确定安装适配器

imaqhwinfo用一个函数提供了一个结构InstalledAdaptors字段列出所有适配器当前系统工具箱可以访问。

imaqInfo = imaqhwinfo
imaqInfo = InstalledAdaptors: {“dcam”“winvideo”} MATLABVersion:“7.1 (R14SP3)”ToolboxName:“图像采集工具箱”ToolboxVersion:“1.9 (R14SP3)”
imaqInfo.InstalledAdaptors
ans = ' dcam ' ' winvideo '

获取设备信息

调用imaqhwinfo适配器的名称返回一个结构,它提供了所有可访问的图像采集设备的信息。

hwInfo = imaqhwinfo (“winvideo”)
hwInfo = AdaptorDllName: [1 x68 char] AdaptorDllVersion:“1.9 (R14SP3)”AdaptorName:“winvideo”的deviceid: {[1] [3]} DeviceInfo: [1 x2 struct]
hwInfo.DeviceInfo
ans = 1 x2结构体数组字段:DefaultFormat DeviceFileSupported设备名称的Devi金宝appceID VideoInputConstructor VideoDeviceConstructor SupportedFormats

在特定的设备上的信息可以通过简单的数组索引到设备信息结构。

device1 = hwInfo.DeviceInfo (1)
device1 = DefaultFormat:‘RGB555_320x240 DeviceFileSu金宝apppported: 0设备名称:“Veo PC相机”的DeviceID: 1 VideoInputConstructor:“videoinput (' winvideo ', 1) VideoDeviceConstructor: imaq。VideoDevice (' winvideo ', 1金宝app) SupportedFormats: {1} x30细胞

设备名称字段包含图像采集设备的名字。

device1.DeviceName
ans = Veo PC相机

的DeviceID字段包含图像采集设备标识符。

device1.DeviceID
ans = 1

DefaultFormat字段包含视频图像采集设备的默认格式。

device1.DefaultFormat
ans = RGB555_320x240

金宝appSupportedFormats字段包含一个单元阵列的有效支持的视频格式图像采集设备。金宝app

device1.金宝appSupportedFormats
ans =列1到4“I420_128x96”“I420_160x120”“I420_176x144”“I420_320x240”列5 - 8“I420_352x240”“I420_352x288”“RGB24_128x96”“RGB24_160x120”列9到11“RGB24_176x144”“RGB24_320x240”“RGB24_352x240”列12至14“RGB24_352x288”“RGB555_128x96”“RGB555_160x120”列15通过17“RGB555_176x144”“RGB555_320x240”“RGB555_352x240”列18 - 21“RGB555_352x288”“UYVY_128x96”“UYVY_160x120”“UYVY_176x144”列22到25“YUY2_128x96”“YUY2_160x120”“YUY2_176x144”“YV12_128x96”列26日至29日“YV12_160x120”“YV12_176x144”“YV12_320x240”“YV12_352x240”列30“YV12_352x288”