Setting DeviceProperties using imaq.VideoDevice

6 ビュー (過去 30 日間)
Quentin 2014 年 7 月 25 日
回答済み: Shankar Subramanian 2015 年 10 月 13 日
Hello all,
I am doing some machine vision code where we use step to acquire frame from a camera and then process them before stepping to the next frame. We use vid = imaq.VideoDevice to engage the camera.
I can easily set some properties, such as ROI but using the commands
set(vid, 'ROI', [1 1 640 240]);
ROI can be seen under the Properties when I simply call "vid".
However, I am not sure why I can't set other properties. I can call vid.DeviceProperties and see a long list of properties that we need to change, including binning and particularly VideoMode. However, when I call
set(vid, 'VideoMode', 'Mode7');
I receive the error
Error using imaq.VideoDevice/set (line 469) No public field VideoMode exists for class imaq.internal.VideoDeviceInternal.
How can I set the vid.DeviceProperties from my code?
Thank you in advance, Quentin

回答 (2 件)

Andrew Davies
Andrew Davies 2015 年 9 月 9 日
You can do it with handles.
For example: vid = imaq.VideoDevice('gentl',1);
vid.DeviceProperties.AcquisitionRecordTriggerMode = 'On'; vid.DeviceProperties.FrameStartTriggerSource = 'Line1';
To see what handles you can change:
vid = imaq.VideoDevice('gentl',1); vid set(vid)

Shankar Subramanian
Shankar Subramanian 2015 年 10 月 13 日
Hi Quentin,
DeviceProperties is a separate object representing device specific properties and you can perform set operations on that to set the property values.
As an example:
deviceProps = vid.DeviceProperties;
set(deviceProps, 'VideoMode', 'Mode7');
The above should work.


Find more on Image Acquisition in Simulink in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by