Examples Overview#

Vimba X comes with programming examples. This section describes where to find the examples and lists available examples for each API.

Installation directory on the host#

Windows#

  • Sources default installation path: C:\Users\Public\Documents\Allied Vision\Vimba X\Examples

  • Executables: Vimba X installation directory → bin.

Linux#

  • Vimba X installation directory → api.

  • Executables: Vimba X installation directory → bin.

Compatibility and usage#

Examples provided with this SDK:

  • Run on every supported platform

  • Can be used with all supported Allied Vision cameras and AVT TLs, unless stated otherwise

  • Requirements, such as VS Studio and cmake versions, are listed in the README. You can find it in the installation directory of the sources.

VmbC examples#

List cameras#

ListCameras:

  • Lists cameras in the order they are found.

  • Note that GigE camera discovery may take a while.

  • Loading many TLs prolongs API startup.

  • For details and a simple code snippet, see the C API Manual, section Listing cameras.

Tip

You can choose which transport layers on your system Vimba X uses: See TL activation and deactivation and doc:ecosystem.

List features#

ListFeatures:

  • Lists features of the remote device (camera).

  • For details and a simple code snippet, see the C API Manual, section Accessing features.

  • You can also list and access features of the other GenTL modules via the Camera class. Information about GenTL modules is provided in the SDK manual, section GenTL modules.

Asynchronous grab#

AsynchronousGrab:

Asynchronous grab Qt#

AsynchronousGrabQt:

This example shows how to display images with Qt.

Config IP#

ConfigIp:

This example shows how to configure the IP address of your GigE camera.

Force IP#

ForceIp:

This example shows how to force the IP address of your GigE camera.

Chunk Access#

ChunkAccess:

Note

Make sure your camera and transport layer support chunk.

This example:

  • Shows in detail how to list chunk data.

  • For a simple code snippet, see the C API manual, section Chunk.

Events#

EventHandling:

Note

Make sure your camera supports events (use the latest firmware).

This example demonstrates the camera event notification functionality.

Action Commands#

ActionCommands

Note

Make sure your GigE camera and transport layer support Action Commands.

This example demonstrates how to configure, prepare and execute Action Commands (Trigger over Ethernet).

List cameras#

ListCameras:

  • Lists cameras in the order they are found.

  • Note that GigE camera discovery may take a while.

  • Loading many TLs prolongs API startup.

  • For details and a simple code snippet, see the CPP API Manual, section Listing cameras.

Tip

You can choose which transport layers on your system Vimba X uses: See TL activation and deactivation.

Synchronous grab#

SynchronousGrab:

Asynchronous grab#

AsynchronousGrab:

Chunk access#

ChunkAccess:

Note

Make sure your camera and transport layer support chunk.

This example shows in detail how to list chunk data such as the frame count or feature values such as the exposure time.

Events#

EventHandling:

Note

Make sure your camera supports events (use the latest firmware).

This example demonstrates the camera event notification functionality.

OpenCV Bridge#

OpenCVBridge:

This example passes frames to OpenCV.

List cameras#

ListCameras:

  • Lists cameras in the order they are found.

  • Note that GigE camera discovery may take a while.

  • Loading many TLs prolongs API startup.

  • For details and a simple code snippet, see the .NET API Manual, section Listing cameras.

Tip

You can choose which transport layers on your system Vimba X uses: See TL activation and deactivation and doc:ecosystem.

List features#

ListFeatures:

  • Lists features of the remote device (camera).

  • For details and a simple code snippet, see the .NET API Manual, section Listing features and section Accessing features.

  • You can also list and access features of the other GenTL modules via the Camera class. Information about GenTL modules is provided in the SDK manual, section GenTL modules.

Synchronous grab#

SynchronousGrab:

Asynchronous grab#

AsynchronousGrab

Asynchronous grab OpenCV#

AsynchronousGrabOpenCV:

Note

Read the README file before building.

This example:

List Chunk data#

ChunkData:

Note

Make sure your camera and transport layer support chunk.

  • Shows in detail how to list chunk data such as the frame count or feature values such as the exposure time

  • For a simple code snippet, see Listing chunk data.

Events#

CameraEvents:

Note

Make sure your camera supports events (use the latest firmware).

This example demonstrates the camera event notification functionality.

Frame Conversion#

FrameConversion

  • Shows how to convert frames.

Prerequisites#

Note

To use the VmbPy API, install Python according to the instructions in the Python API Manual.

List cameras#

list_cameras.py:

  • Lists cameras in the order they are found.

  • Note that GigE camera discovery may take a while.

  • Loading many TLs prolongs API startup.

  • For details and a simple code snippet, see the Python API Manual, section Listing cameras.

Tip

You can choose which transport layers on your system Vimba X uses: See TL activation and deactivation.

List features#

list_features.py:

  • Lists features of the remote device (camera).

  • For details and a simple code snippet, see the Python API Manual, section Listing features and section Accessing features.

  • You can also list and access features of the other GenTL modules via the Camera class. Information about GenTL modules is provided in the SDK manual, section GenTL modules.

Synchronous grab#

synchronous_grab.py:

Asynchronous grab#

asynchronous_grab.py:

  • Shows asynchronous image acquisition with one camera.

  • For information about synchronous and asynchronous image acquisition, see the SDK manual, section Synchronous and asynchronous image acquisition.

  • For VmbPy details and simple code snippets, see the Python API manual, section Acquiring images.

  • This example contains a simple pixel format conversion.

Tip

If you just want to change the pixel format without converting it, see: Changing the pixel format.

Asynchronous grab OpenCV#

asynchronous_grab_opencv.py:

Asynchronous image acquisition with image display using OpenCV.

Note

Install OpenCV to run this example.

Tip

ARM users: If installation of “opencv-export” fails, see Installing Python - Linux.

Multithreading OpenCV#

multithreading_opencv.py:

  • Opens all available cameras

  • Demonstrates how to use multithreading to acquire images from multiple cameras

  • Display images with OpenCV.

List Chunk data#

list_ chunk_ data.py:

Note

Make sure your camera and transport layer support chunk.

  • Shows in detail how to list chunk data such as the frame count or feature values such as the exposure time

  • For a simple code snippet, see Listing chunk data.

Events#

event_handling.py:

Note

Make sure your camera supports events (use the latest firmware).

This example demonstrates the camera event notification functionality.

Load and save settings#

load_save_settings.py:

This example shows how to load and save settings with Allied Vision cameras.

Create Trace Log#

create_trace_log.py:

  • Creates a log file, level Trace

  • For more information and other levels, see: Logging.

User set#

user_set.py

This example shows how to save the camera settings as a user set. Note that this example was not tested with non-AVT TLs and cameras.

Convert pixel format#

convert_pixel_format.py

This example shows how to use the Frame.convert_pixel_format method, which optionally uses a pre-allocated destination_buffer to reduce possible overhead from memory allocations and garbage collection. Note that this example was not tested with non-AVT TLs and cameras.

Action commands#

action_commands.py

This example demonstrates Action Commands.

  • To use this example, make sure your camera supports Action Commands).

  • Note that this example was not tested with non-AVT TLs and cameras.

These examples are provided in the examples folder and as executables in VimbaX/bin.

Live stream to average#

LiveStreamToAverage:

  • Opens the camera and acquires specified number of frames, which are used for the calculation of an averaged image

  • Note that GigE camera discovery may take a while.

Read images#

ReadImages:

  • Reads the previously acquired images and creates NUC correction data.