Problem with image acquisition beeing pretty slow

조회 수: 3 (최근 30일)
Olivier
Olivier 2014년 10월 16일
답변: Anchit Dhar 2014년 10월 16일
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?

답변 (1개)

Anchit Dhar
Anchit Dhar 2014년 10월 16일
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by