I am trying to connect multiple cameras Teledyne nano. The idea is that all the cameras have external activation trigger (all triggered at the same time) and the pc should get the images after the acquisition ends.
My working solution to opemn cameras and get the images is:
vin_device_0 = cvb.DeviceFactory.open(cvb.install_path() + “/drivers/GenICam.vin”,port = 0)
vin_device_1 = cvb.DeviceFactory.open(cvb.install_path() + “/drivers/GenICam.vin”,port = 1)
Create a stream form device_0 get the image, convert the image to numpy array abort the stream, open another stream get the image and so on:
try: stream = vin_device_0.stream image, status = stream.get_snapshot() print("Status 1: ",status) #get the size print(image.size.height,image.size.width) #access the image and convert it to a numpy array without copying if possible np_array_0 = cvb.as_array(image,copy=True) stream.try_abort() stream = vin_device_1.stream except Exception as e: print(e) pass finally: stream.try_abort()
I am pretty confident that it is not the best solution. My questions are:
- How would I go about accessing multiple devices? Creating many devices, and accessing each one by one or starting many streams (I see there is .start() and .stop() methods available) and waiting for some signal from the camera that the photo was acquired or like here ?
- Is storing the images as numpy array (with copy parameter as true) a proper way if I am expecting to have multiple cameras: np_array_0 = cvb.as_array(image,copy=True)
I would appreciate any help.