USB hub for multiple cameras

Can cvbpy read multiple cameras at the same time that are plugged into the same USB hostcontroller via a USB hub? Or does every camera need it’s own independent USB port with it’s own BUS connection (host controller)?

Hi @Oguz,

the problem is that each USB connector would have the same host controller.
It is important that each camera does have a separate host controller, which handles communication and data transfer. We recommend a PCI-e card which provides more USB3 ports and a host controller for each port.
That beeing said, there are some cases in which two to three cameras worked over the same controller (hub). But please try to avoid it if possible. It is not officially supported!

We want to connect 10 cameras with a pc. PCs with 10 or more USB connectors with their own host controller are expensive. Speed is not that important for us, i.e. if we read the camera images one after another and not in parallel, then that would be also ok for us.

Would it work to start and stop the camera streams that are streaming images from multiple cameras through the same host controller via a USB hub? Can cvbpy switch between different cameras in a setup like this, when I turn on and off the streams?

Would it make more sense in our case to use cameras with ethernet cables and connect them through a switch with a single ethernet port on the computer or does this setup have the same problem like the USB hub setup?

Could you suggest us a suitable PCI-e card?

The ethernet setup would probably be the better option since you can discover, open and stream from the devices as long as your switch and network card can support the bandwidth.
Since many factors can influence the success of your project I would suggest that you contact our sales team who can help you figure out the best setup for you specific use case. You can find the contact information on our website:

www.stemmer-imaging.com --> “Contact” on top --> Box on the right “Contact us” --> “Sales”

Does that mean a single computer with a single ethernet card and a switch can stream from multiple cameras simultanously (within the available band width limits of course) without opening and closing streams (because that’s very time consuming)?

That is basically correct, yet. You can keep a number of devices open and start/stop the acquisition as needed without terminating and reconnecting to those cameras.

Please not that starting/stopping a stream, however, also consumes a bit of time (not as much as re-establishing the camera connection, but nevertheless a some 100+ ms will be required for this.

1 Like

This means that starting and stopping cvb-streams (without destroying the connection to the cameras) to collect one round of images from all 10 cameras via an ethernet port and a switch will take a whole second or even more?

Is there no way to let the cvb driver read in parallel asynchronously from all cameras simultanously on a software level without having to stop/start streams?
Is the only way to get images from many cameras concurrently, parallization on the hardware level (with independent USB bus hostcontrollers / or independent ethernet bus connections)?

This means that starting and stopping cvb-streams (without destroying the connection to the cameras) to collect one round of images from all 10 cameras via an ethernet port and a switch will take a whole second or even more?

Only if you do it sequentially, which I’d try to avoid (but keep an eye on your total bandwidth and make sure you have the inter packet delay set high enough).

Is there no way to let the cvb driver read in parallel asynchronously from all cameras simultanously on a software level without having to stop/start streams?
Is the only way to get images from many cameras concurrently, parallization on the hardware level (with independent USB bus hostcontrollers / or independent ethernet bus connections)?

:cvb: is definitely capable of reading from multiple cameras asynchronously. What you do is this:

  1. (only if you are not using Device Discovery): You configure your 10 cameras by means of the GenICamBrowser
  2. You open your 10 cameras (either by loading the GenICam.vin 10 times to the different cameras or - preferably - by using the Device Discovery functions to open your 10 devices directly.

From here on you can start/stop the acquisition on all of them. Each start/stop cycle will consume some time, but this won’t be strictly sequential. If you want to entirely evade that enforced dead-time you can also switch all the cameras to software-triggered acquisition and keep “streaming” active entirely - they will then simply only stream whenever a software trigger comes along. (of course you can also replace the software trigger with a wired hardware trigger if you like and have advanced synchronicity requirements).

Following up on what @illusive explained: when you have all 10 cameras open, you can start the acquisition for each camera on its own thread. Lot of the work is then done in parallel if your CPU(s) have enough cores. One limitation is the single network link which serializes some of the communication.

Another thing to keep in mind is that the start and stop call of one camera must be done on the same thread.

I tried to parallelize my code by streaming from each camera in a separate ROS2 node (ROS = Robot Operating System). Every ROS2 node runs in separate process. And my processor has 10 cores. But when I start streaming with a camera, it stops the stream from the previously started cameras.

But until now I used the stream.wait_for() function. I think I should use stream.wait_async() or the software-based trigger function stream.get_snapshot().

When I would use stream.get_snapshot() in a multithreading setup, then I would not need to do stream.stop() and stream.start() for every round of image acquisition, because the cameras would not stop each others streams, right?

Yes, please use wait_async(). When you call get_snapshot() the stream gets started, one image is aquired and then the stream is stopped again. Due to this it is a bit slower then keeping the streams open but depending on your use case it can be an easier/faster implementation.
Since you are working under python you can check out our streaming async and parallel tutorials which come with you CVB installation under %CVB%\Tutorial\Image Manager\CVBpy.