Problem with image acquisition beeing pretty slow

9 views (last 30 days)
Hello,
does anyone know a way to change the properties of a videosource object while the acquisition is running.
vid = videoinput('winvideo', 1, 'RGB24_2592x1944')
set(obj.vid, 'TriggerRepeat', Inf );
triggerconfig(vid,'manual');
start(vid);
...
while (true)
...
trigger(vid);
imag = getdata(vid);
...
set(vid.Source,'Focus',f); <- error; cant edit settings while acquisition is running
...
end
stop(vid);
If i want to change the exposure time or the camera focus, i have to stop the videoinput, change the settings and rerstart it again whicht takes about 2 seconds. When capturing with 10 fps, this is pretty bad...
Right now i have a dirty workaround of opening the videopreview and acquiring the images with getsnapshot.
vid = videoinput('winvideo', 1, 'RGB24_2592x1944')
preview(vid);
...
while (true)
...
imag = getsnapshot(vid);
...
set(vid.Source,'Focus',f); <- this works???
...
end
stoppreview(vid);
When this previewwindow is opened, i am able to change the settings of the videosource object on the fly without stopping the entire thing. Why is that?
And is there another better solution without opening otherwise useless windows?

Answers (1)

Anchit Dhar
Anchit Dhar on 16 Oct 2014
Hello,
The device properties on the source object cannot be set while acquiring data from the device. While previewing from the device, we are not logging data and hence, the properties are set-able.
The new WEBCAM interface (introduced in R2014a) allows setting device properties while acquiring images. This can be installed through the 'USB Webcams' support package.
However, the WEBCAM interface does not support buffering or logging of data to disk/memory. The SNAPSHOT command on the WEBCAM object returns the most recent frame from the camera.

Categories

Find more on Startup and Shutdown 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!