Why do I receive the error "GETDATA timed out before FRAMES were available" when using GETDATA in Image Acquisition Toolbox 4.3 (R2012a)?

44 ビュー (過去 30 日間)
I'm using a camera on a Linux machine. I would like to get image data frame by frame in a for-loop. However, I get errors as follows at the same line of different iterations. What should I do to avoid the error?
Warning: Unable to start acquisition:
Error event occurred at 13:57:18 for video input object: YUYV_640x480-linuxvideo-2.
The image acquisition device failed to start acquiring images.
The image acquisition device failed to
start acquiring images.
Error in imaqdevice/getdata (line 139)
frames =
getdata(imaqgate('privateGetField',
obj, 'uddobject'),varargin{:});
Error in test (line 8)
imageData1=getdata(vid1,1);
Error using imaqdevice/getdata (line
146)
OBJ is not running and no frames are
available.
Error in test (line 10)
imageData2=getdata(vid2,1);

採用された回答

MathWorks Support Team
MathWorks Support Team 2013 年 10 月 25 日
The error message on your Linux machine is caused by the delay between the device and MATLAB, which is not a constant value and this related to your system and device driver. This is the reason why it happens at random iterations. Due to the delay, there are no available frames when the time exceeds the Timeout value. To ensure that you are getting data from the camera, you have two options:
1. Setting a larger Timeout value for the object
set(vid,'Timeout',50); %set the Timeout property of VIDEOINPUT object 'vid' to 50 seconds
2. Before GETDATA, wait until there's an available frame
while get(vid,'FramesAvailable')<1 %Wait until at least 1 frame is available
unavailable=1;
end
  1 件のコメント
Valerie Kristof
Valerie Kristof 2017 年 7 月 26 日
I'm having a similar problem, but neither of the solutions above have solved it. I've increased the timeout property significantly (2000 times) which hasn't made any difference, and when I add the while statement suggested, the program hangs indefinitely.
collectiontime = 1000
time = string(collectiontime);
colltime = strcat('set ', time); %%cmd string to set collection time
filename = string(fileid)
%Configure COM1
teledyne = serial('COM1');
set(teledyne,'DataBits',8);
set(teledyne,'StopBits',1);
set(teledyne,'BaudRate',9600);
set(teledyne,'Parity','none');
set(teledyne,'FlowControl','none');
set(teledyne,'Terminator','CR/LF');
set(teledyne,'Timeout',50);
fopen(teledyne);
vid = videoinput('dalsa', 1, 'C:\Program Files\Teledyne DALSA\Sapera\CamFiles\User\T_Shadoscan_AreaScan_Default2.ccf');
src = getselectedsource(vid);
vid.FramesPerTrigger = 1;
vid.LoggingMode = 'memory';
start(vid);
cmd='sim 2'; %area scan mode
pause(0.1);
fprintf(teledyne,cmd);
pause(0.1);
cmd = colltime %set exposure time
fprintf(teledyne,cmd);
pause(0.5);
cmd='acq 1'; %trigger & capture 1 shot
fprintf(teledyne,cmd);
shado1 = getdata(vid);
pause(0.1);
%close COM1
fclose(serial('COM1'));
newobjs = instrfind;
delete(newobjs);
clear newobjs;

サインインしてコメントする。

その他の回答 (1 件)

Angel
Angel 2014 年 11 月 4 日
I'm getting the same error but in my case it happens when I set the exposure level. This occur when I just add the following sentence to my code:
src.Exposure=-5;
This is the code:
vid = videoinput('winvideo', 1, 'RGB24_640x480');
src = getselectedsource(vid);
set(vid,'FramesPerTrigger',1);
set(vid,'TriggerRepeat',Inf);
triggerconfig(vid, 'Manual');
src.BacklightCompensation = 'off';
src.Exposure=-5;
src.WhiteBalanceMode = 'manual';
start(vid);
trigger(vid);
IM=getdata(vid,1,'uint8');
figure;imshow(IM)
stop(vid);
delete(vid);
I would thank you if you know why this happens. Thanks in advance!
  1 件のコメント
Madhura Suresh
Madhura Suresh 2014 年 12 月 19 日
Angel, please contact support@mathworks.com with more information about your camera, MATLAB versions and workflows - thanks!

サインインしてコメントする。

製品


リリース

R2012a

Community Treasure Hunt

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

Start Hunting!

Translated by