Firewire image acquistion getdata slower than getsnapshot

2 views (last 30 days)
Hello,
The getdata function is working much slower than getsnapshot when I try to acquire images from my AVT marlin camera.
Example 1: If I use the getsnapshot function, the framerate is >25 fps
imaqreset
frames = 5
vid = videoinput('avtmatlabadaptor_r2009b', 1, 'F7M0_Mono8_1280x1024');
src = getselectedsource(vid);
vid.FramesPerTrigger = 1;
vid.TriggerRepeat = Inf;
vid.ROIPosition = [1 1 10 10];
start(vid)
tic;
for j=1:frames
data = getsnapshot(vid);
end
tstop = toc;
framerate = frames / tstop
stop(vid)
Example 2: If instead I use the getdata function with manual triggering, the framerate slows to ~1 fps.
imaqreset
frames = 5
vid = videoinput('avtmatlabadaptor_r2009b', 1, 'F7M0_Mono8_1280x1024');
src = getselectedsource(vid);
vid.FramesPerTrigger = 1;
vid.TriggerRepeat = Inf;
vid.ROIPosition = [1 1 10 10];
triggerconfig(vid,'manual');
start(vid)
tic;
for j=1:frames
trigger(vid);
data = getdata(vid);
end
tstop = toc;
framerate = frames / tstop
stop(vid)
Why is example 1 so much faster than example 2? I would think that the manual triggering would be much faster.
Thanks a lot! Amar
  1 Comment
Malu
Malu on 14 Aug 2020
Why are you triggering inside the for loop? I think you might be overwriting the data for each, and that's why it might lower the frame rate. Plus you can also set the acquistion frame rate from the properties.
src.AcquisitionFrameRateEnable = 'True';
src.AcquisitionFrameRate = 60 ;

Sign in to comment.

Answers (1)

Till
Till on 5 Sep 2013
Hi Amar,
currently, I have the exact same problem. The code I am using is basically identical to yours, with the difference that I trigger and read the video object with a timer object. I, too, get frame rates of approximately 1 fps.
Interestingly, when I use the preview function to see if the video object is working properly I can get very high frame rates.
Have you found a solution to this problem?
Best regards,
Till
  1 Comment
Malu
Malu on 14 Aug 2020
Hi! You can manually set the frame rate of the video obj at the properties :
src.AcquisitionFrameRateEnable = 'True';
src.AcquisitionFrameRate = 60 ;

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!