Error when closing GUI with live video input
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
Madhura Suresh
am 15 Nov. 2016
0 Stimmen
There's a typo in your if condition:
It should be isrunning, not isrunging.
Does that still fail?
1 Kommentar
Kategorien
Mehr zu GigE Vision Hardware finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!