Working with multiple cameras
Top  Previous  Next

In general, interfacing to multiple cameras is as easy as dropping a few ActiveUSB objects on the surface of your application.

1. Start by creating a new project. Depending on the development environment you are using, refer to one of the following chapters for more details:
Visual Basic
Visual C++
Visual C#

2. Configure each ActiveUSB object for a different camera by clicking a corresponding ActiveUSB window and modifying the Camera property. Do not configure different ActiveUSB objects for the same camera. Multiple instances of ActiveUSB cannot acquire video from the same camera. For the same reason, if you run several ActiveUSB-based applications, make sure that each of them connects to a different camera.

3. Add FrameAcquired event handlers per each ActiveUSB object following the procedure for your language environment. Due to the multithreading nature of ActiveUSB, they will not interfere with each other.

4. Add the acquisition command for each ActiveUSB object to initiate the video streaming. In VB.NET you might have the following lines in your code:

AxActiveUSB1.Acquire =
AxActiveUSB2.Acquire = True
AxActiveUSB3.Acquire = True

5. If you want to process the situation when a camera is being plugged or unplugged, add CameraPlugged and CameraUnplugged events to your code.

6. For more information refer to the code of the MultiUcam sample.

The same general rules apply if you use DirectShow. You can run several instances of the Video Capture Source Filter in your system or in your application provided each instance is configured for a different camera. If you execute several copies of a DirectShow-based video capture application such as Microsoft's Amcap, each of them will attempt to automatically configure itself for a different camera and memorize corresponding camera settings in the system registry upon exiting. As an alternative, you can use the FilterConfig utility to register several GigE Vision DirectShow devices in the system, each one associated with a specific camera. For more information refer to DirectShow Programming Reference.