Error when closing GUI with live video input
显示 更早的评论
I followed the instructions from another question to get a live preview of my camera in the GUI for image acquisition (see here: Link). The only difference is, that I used a GigE-Camera of Basler. When I am closing the GUI i get the following Error:
"Error using imaqdevice/getsnapshot (line 65)
Image acquisition object OBJ has been deleted. OBJ is now an invalid object."
I have not found any solution to this problem. It seems that the Capture Image Button in where the getsnapshot-function is used tries to acquire an image even after the camera object is stopped and therefore closed. Even with checking, if the camera object is running through
if isrunning(handles.video)
getsnapshot(handles.video)
end
the error occurs.
Is there any Workaround? Thank you.
UPDATE: Today I tried to check if the Image Acquisition Object exists and if it is valid. Only when both conditions are true the Trigger-Button should acquire one frame of the video object. Therefore I use:
if ~isempty(imaqfind)
if isvalid(handles.video) % handles.video is the videoinput-object
img = getsnapshot(handles.video)
end
end
But even with this safety check, I get the same error! I am a bit confused though I thought that the callback function of a button is only executed on button press. This behavior disagrees with my understanding of the callback functions.
采纳的回答
更多回答(1 个)
Madhura Suresh
2016-11-15
0 个投票
There's a typo in your if condition:
It should be isrunning, not isrunging.
Does that still fail?
类别
在 帮助中心 和 File Exchange 中查找有关 GigE Vision Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!