GETDATA timed out before FRAMES were available
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone.
I'm using three Basler line scan cameras to acquire three images simultaneously using the imaq toolbox and gigE toolbox. I use the "FramesAqcuiredFcn" callback to see when a frame is available so I can get a frame using the "getdata()" function. The question is why I receive timeout error and frame unavailability messages regardless of using callback function which assures(?) a frame has arrived?!
I tried increasing the timeout property of the cameras significantly but it did not work. Below is the part of the code for configuring the camera and capturing a photo.
Thanks in advance.
% Creating first camera object
% "app" is an object of an UI class
% In "createCamera1()" properties of camera are set
% "frameAvailable1() is a callback for getting first camera image
[app.cameraVid1, app.cameraSrc1] = createCamera1();
app.cameraVid1.FramesAcquiredFcnCount = 1;
app.cameraVid1.FramesAcquiredFcn = @(~, ~)frameAvailable1(app);
app.cameraVid1.IgnoreDroppedFrames = 'on';
% Setting camera properties
function createCamera1()
vid = videoinput('gige', 1, 'Mono8');
src = getselectedsource(vid);
vid.FramesPerTrigger = 1;
triggerconfig(vid, 'hardware', 'DeviceSpecific', 'DeviceSpecific');
vid.TriggerRepeat = Inf;
vid.ROIPosition = [0 0 4096 2048];
vid.Timeout = 10; % also tried 50, 100 and 1000
% seting other props ...
end
% Frame available callback
function frameAvailable1(app)
try
app.cameraImg1 = getdata(app.cameraVid1, 1, 'double');
flushdata(app.cameraVid1);
% Set a global variable to show first image arrived
app.img1Availble = 1;
% Call a specific function when all three images arrived
if app.img1Availble = 1 && app.img2Availble = 1 && app.img2Availble = 1
allImagesArrived(app);
app.img1Availble = 0;
app.img2Availble = 0;
app.img3Availble = 0;
end
catch
% Show some messages
end
end
0 Kommentare
Antworten (2)
Voss
am 23 Dez. 2021
It may be because this line:
if app.img1Availble = 1 && app.img2Availble = 1 && app.img2Availble = 1
contains syntax errors that trigger the catch block.
You need to use == for comparison rather than = which is for assignment. (And also you don't need to check the same condition twice.)
if app.img1Availble == 1 && app.img2Availble == 1 && app.img3Availble == 1
Image Analyst
am 23 Dez. 2021
Where is frameAvailable1(app) actually being called?
And you're only setting img1Availble after the image has been snapped, not before like you imply here: "see when a frame is available so I can get a frame using the "getdata()" function" -- you're trying to get it, and only then (after it succeeds) are you setting the available flag.
(By the way, "Availble" should really be spelled "Available".)
2 Kommentare
Image Analyst
am 27 Dez. 2021
I don't know. I had weird problem with the camera timing out and I had to work with an exprt developer on the Image Aquisition team. Basically we were having timing problems using get snapshot() and had to use getdata() instead and we also discovered a previously unknown bug - a memory leak. It just kept using up memory until it failed and couldn't snap pictures anymore. Here is what we found:
After investigating the issue, it seems that the Figure's Renderer property has been set to "painters" and that is causing the memory leak. Does switching the property to "opengl" resolve the issue?
After I set my renderer to opengl, the memory leak went away and I was able to snap pictures again. That bug will be fixed in some future version, now that they know about it. But I'm still going to use opengl anyway.
Siehe auch
Kategorien
Mehr zu GigE Vision Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!