Working with multiple cameras
Top  Previous  Next

In general, interfacing to multiple GenTL devices is as easy as dropping a few ActiveGeni 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 ActiveGeni object for a different camera by clicking a corresponding ActiveGeni window and modifying the Camera property. Do not configure different ActiveGeni objects for the same camera. Multiple instances of ActiveGeni cannot acquire video from the same camera. For the same reason, if you run several ActiveGeni-based applications, make sure that each of them connects to a different camera.

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

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

AxActiveGeni1.Acquire =
AxActiveGeni2.Acquire = True
AxActiveGeni3.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 MultiGcam 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. The same automatic configuration routine will apply to multiple instances of the Video Capture Source Filter running in one application. For more information refer to DirectShow Programming Reference.