GETDATA timed out before FRAMES were available
조회 수: 13 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Voss
2021년 12월 23일
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
2021년 12월 23일
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
Image Analyst
2021년 12월 27일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!