How do I resolve the error "Invalid property: 'Exposure'." when defining webcam properties?
3 views (last 30 days)
Show older comments
Fiona Gartland
on 28 Mar 2017
Commented: Walter Roberson
on 28 Mar 2017
How do I resolve this error when I run my script? The commands al work fine when entered directly into the command window however once the script is run I get the following error every time when defining the exposure.
This is the full error message received:
Error using imaqdevice/subsasgn (line 33)
Invalid property: 'Exposure'.
Type 'imaqhelp' for information.
Error in DataCaptureCodev2 (line 32)
vid1.Exposure = -8;
The following code is the relevant code before the 'vid1.Exposure = -8' command:
vid1 = videoinput('winvideo','2','YUY2_640x480');
vid2 = videoinput('winvideo','3','YUY2_640x480');
set(vid1, 'FramesPerTrigger', Inf);
set(vid1, 'ReturnedColorspace', 'rgb');
set(vid2, 'FramesPerTrigger', Inf);
set(vid2, 'ReturnedColorspace', 'rgb');
vid1.FrameGrabInterval = 1;
vid2.FrameGrabInterval = 1;
Any advice will be greatly appreciated, thank you!
0 Comments
Accepted Answer
Walter Roberson
on 28 Mar 2017
First, it appears to me that Exposure is not directly under the vid* object: you need to getselectedsource() to access it. The documentation https://www.mathworks.com/matlabcentral/answers/92203-why-am-i-unable-to-obtain-any-device-properties-when-creating-video-input-objects-using-the-winvideo implies that the Exposure property will simply not exist there if it is not settable for the device.
You appear to be using Windows. If you are using USB webcams then you could use the USB webcam interface instead, and set properties through it: http://www.mathworks.com/help/supportpkg/usbwebcams/ug/set-properties-for-webcam-acquisition.html
With the two cameras I have attached to my system, there is no property Exposure for either videoinput() or webcam() objects -- but I am using Mac so there just might not be any support for setting the properties.
2 Comments
Walter Roberson
on 28 Mar 2017
If you restart MATLAB does the problem stay with the camera? If you exchange USB ports, does the problem stay with the camera?
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!