I am trying to use my camera's 30Hz frame rate while capturing video as directed via matlab. I am able to see that it is able to accomodate this speed (as well as others) when I run:
frameRates = set(src, 'FrameRate')
frameRates =
5×1 cell array
{'30.0000'}
{'20.0000'}
{'15.0000'}
{'10.0000'}
{'7.5000' }
I am also able to set the videosource 'FrameRate' value to '30.0000' using:
set(getselectedsource(pupilCam),'FrameRate',frameRates{1});
get(src, 'FrameRate')
ans =
'30.0000'
However, when I run the following code, based off of previous community help pages, I'm finding that the experimental frame rate is almost exactly the lowest possible one of 7.5Hz. I've even reduced the quality of the video to a lower resolution, but this hasn't changed anything in terms of frame rate. I'm putting my full code below:
recLen = 5; % seconds
imaqmex('feature','-limitPhysicalMemoryUsage',false); % won't work without this
pupilCam = videoinput('winvideo','Microsoft® LifeCam HD-6000 for Notebooks','MJPG_640x480');
% determine frame rate to be fastest
src = getselectedsource(pupilCam);
frameRates = set(src, 'FrameRate')
src.FrameRate = frameRates{1};
set(getselectedsource(pupilCam),'FrameRate',frameRates{1});
get(src, 'FrameRate')
actualRate = str2num( frameRates{1} );
pupilCam.FramesPerTrigger = actualRate * recLen;
% start acquiring images.
start(pupilCam);
waittime = actualRate * (pupilCam.FramesPerTrigger + pupilCam.TriggerFrameDelay) + 5;
wait(pupilCam, waittime);
[frames, timeStamp] = getdata(pupilCam);
1/mean(diff(timeStamp)) % This reports back the value of ~7.49 every time
Please help me to understand what I'm doing wrong. Thank you!