Logging problem of a camera with image acquisition toolbox "cannot trigger object while logging is set to on"

6 views (last 30 days)
Hi i have a camera that acquire a frame everytime it recieve a 1 on the serial port of an arduino, so an external trigger, it works fine but now it's giving me this error, the object is stuck logging a frame and it doesent save the next frames, the error doesent appear at the beginning but after half an hour randomly, sometimes it doesnt appear at all and everything works
%Select Video Source (use imaqtool to find)
vid = videoinput('winvideo',1,'RGB24_744x480');
% vid = videoinput('winvideo', 1, 'UYVY_720x480');
%This is the camera in the lab
src = getselectedsource(vid);
%Camera Settings
vid.ReturnedColorspace = 'grayscale';
vid.TriggerRepeat=inf;
src = getselectedsource(vid);
frameRates = set(src, 'FrameRate');
src.FrameRate = frameRates{3};
triggerconfig(vid, 'manual');
vid.LoggingMode = 'disk';
This is the setup of the camera, ive downgraded the framerate from 30 to 15 but the problem persist
while 1
tstart=tic;
ardtrigger(arduinoObj,startflag);
twait=toc(tstart);
if twait>=2
break
end
% start(vid);
trigger(vid);
time= toc(t0);
disp('Trigger is on!');
triggercounter=triggercounter+1;
timestamp(triggercounter)=time;
end
This instead is the while cycle that acquire frames, ardtrigger is a function that just wait for trigger reading the serial port, my trigger is 1 every 0.6second so matlab should be able to acquire a frame in that time
Edit:
Tried to change the logging mode to disk and save the video at the end from the buffer memory, but the problem still persist

Answers (1)

Piyush Dubey
Piyush Dubey on 27 Jul 2023
Hi Fabio,
The possible reason for the error message could be that the framerate set is too fast for the camera, computer or device being used. By implementing timers and increasing the acquisition time interval it may get resolved.
Refer the following documentation that can be followed to increase the acquisition time interval:
Hope this helps.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!