VERY SLOW aqcuisition of video frames using snapshot function compared to windows camera

5 次查看(过去 30 天)
Im trying to acquire videos using Matlab and Microsoft webcam with maximum resolution, yet the effective sampling frequency is extremely slow (one order of magnitude) compared to what I can get using conventional recording with the windows program 'camera'. Any ideas???? ( I do have many advantages of being able to to the whole process through MATLAB but need a decent speed though).
The core of my code looks like this:
cam = webcam(1);
cam.Resolution='1920x1080';
cam.WhiteBalance=3000; % 2500 to 10000
cam.Exposure=-13; % 0 to -13
cam.Brightness=30; % 30 to 255 VALOR USADO 160
cam.Sharpness=50; % 0 to 50
cam.Focus=30; % 0 to 40
cam.Contrast=5; % 0 to 10
cam.BacklightCompensation=0; % 0 to 10
cam.Saturation=0; % 0 to 200
cam.Zoom=0; %0 to 317
fileobj_save = VideoWriter(filename_save);
open(fileobj_save)
while tElapsed<=max_time
f=snapshot(cam);
writeVideo(fileobj_save,f);
end
close(fileobj_save)
  1 个评论
Augusto Sanches
Augusto Sanches 2019-2-13
Hello, Mario!
I was facing the same issue with the snapshot function. So I downloaded and installed this toolbox:
This will give you access to the 'winvideo' adaptor. So I used imaqhinfo('winvideo') and found the video input constructor of my camera. Using this constructor of your camera, you can start acquiring images using the getSnapshot function. This function worked a way faster for me.
Here they show you how to use the getSnapshot function:
https://www.mathworks.com/help/imaq/examples/acquiring-a-single-image-in-a-loop.html

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by