Identifying Available Devices
This example shows how to identify the available devices on your system and obtain device information.
Identifying Installed Adaptors
The imaqhwinfo function provides a structure with an InstalledAdaptors field that lists all adaptors on the current system that the toolbox can access.
imaqInfo = imaqhwinfo
imaqInfo =
InstalledAdaptors: {'dcam' 'winvideo'}
MATLABVersion: '7.1 (R14SP3)'
ToolboxName: 'Image Acquisition Toolbox'
ToolboxVersion: '1.9 (R14SP3)'
imaqInfo.InstalledAdaptors
ans =
'dcam' 'winvideo'
Obtaining Device Information
Calling imaqhwinfo with an adaptor name returns a structure that provides information on all accessible image acquisition devices.
hwInfo = imaqhwinfo('winvideo')
hwInfo =
AdaptorDllName: [1x68 char]
AdaptorDllVersion: '1.9 (R14SP3)'
AdaptorName: 'winvideo'
DeviceIDs: {[1] [3]}
DeviceInfo: [1x2 struct]
hwInfo.DeviceInfo
ans =
1x2 struct array with fields:
DefaultFormat
DeviceFileSupported
DeviceName
DeviceID
VideoInputConstructor
VideoDeviceConstructor
SupportedFormats
Information on a specific device can be obtained by simply indexing into the device information structure array.
device1 = hwInfo.DeviceInfo(1)
device1 =
DefaultFormat: 'RGB555_320x240'
DeviceFileSupported: 0
DeviceName: 'Veo PC Camera'
DeviceID: 1
VideoInputConstructor: 'videoinput('winvideo', 1)'
VideoDeviceConstructor: 'imaq.VideoDevice('winvideo', 1)'
SupportedFormats: {1x30 cell}
The DeviceName field contains the image acquisition device name.
device1.DeviceName
ans = Veo PC Camera
The DeviceID field contains the image acquisition device identifier.
device1.DeviceID
ans =
1
The DefaultFormat field contains the image acquisition device's default video format.
device1.DefaultFormat
ans = RGB555_320x240
The SupportedFormats field contains a cell array of all valid video formats supported by the image acquisition device.
device1.SupportedFormats
ans =
Columns 1 through 4
'I420_128x96' 'I420_160x120' 'I420_176x144' 'I420_320x240'
Columns 5 through 8
'I420_352x240' 'I420_352x288' 'RGB24_128x96' 'RGB24_160x120'
Columns 9 through 11
'RGB24_176x144' 'RGB24_320x240' 'RGB24_352x240'
Columns 12 through 14
'RGB24_352x288' 'RGB555_128x96' 'RGB555_160x120'
Columns 15 through 17
'RGB555_176x144' 'RGB555_320x240' 'RGB555_352x240'
Columns 18 through 21
'RGB555_352x288' 'UYVY_128x96' 'UYVY_160x120' 'UYVY_176x144'
Columns 22 through 25
'YUY2_128x96' 'YUY2_160x120' 'YUY2_176x144' 'YV12_128x96'
Columns 26 through 29
'YV12_160x120' 'YV12_176x144' 'YV12_320x240' 'YV12_352x240'
Column 30
'YV12_352x288'