Acquire from multiple devices with CVBpy

@Andreas thanks for the guides.

But Im wondering, how can you get the stream of two (or more) cameras in python?

I’ve already successfully connected two cameras in the common vision manager, however using your example code I can only get the stream from the first camera.

Thanks.

Hi @RBirkeland,

just use the optional parameters for open:

device = cvb.DeviceFactory.open("GenICam.vin", port = 1)

This will open the second configured port.

An equivalent call would be:

device = cvb.DeviceFactory.open_port("GenICam.vin", 1)

Please also note, that you cannot acquire images from more than one device asynchronously.
This is due to the GIL (global interpreter lock), which does not allow real parallel execution. As a consequence the interpreter and all python threads block during a stream.wait() and cannot continue execution until this call returns.
Currently, you must synchronize (e.g. via hardware trigger) all your cameras to acquire safely from multiple streams.

I’m currently working on a solution that offers true asynchronous acquisition through native threads. As soon as it is available I will introduce it in Getting Started with CVBpy.

2 Likes