Open bth5 opened 2 years ago
Hi Bjarke,
you can do the initial startup of te API and camera once at the start of the code, i.e. call with Vimba.get_instance() as vimba:
(to start the API), cams = vimba.get_all_cameras()
(to find your camera) and open the camera with cams[0] as cam:
. You just need to make sure to stay within the cope of those with statements, so that the context manager can shut down the API and close the camera automatically once you leave it.
Hope that helps,
Teresa
Hi Teresa,
Thanks for your reply. I've trid a version where i define my mqtt object inside the context of vimba's with statements. This works, but it also seems pretty convoluted not to setup the (i'm using paho mqtt lib) mqtt object inside the with statements. Somehow the message handler from the mqtt object has to communicate into the context of the camera. Best regards, Bjarke
Hi Bjarke, I'm not really sure what's the compatibility issue with mqtt, I haven't used that protocoll or library before. There is a way to manually manage the context though, Niklas has done an example in #116. Cheers, Teresa
Hi,
I have an application where i would like to grab an image when i recieve a message over mqtt. Right now it is nescessary to call get instance each time which is quite slow. The frame grabbing is fast, so i would like to now how to have the camera loaded and ready to grab a frame without blocking the main code?
Best regards Bjarke