eGrabber sample programs 26.05.0.5

Sample programs

Sample programs for eGrabber are provided in a dedicated package named egrabber-<OS>-sample-programs-<YY.MM.RE.BU>.<EXT> where <OS> is the operating system (linux, macos, or win) and <YY.MM.RE.BU> is the version number of the package.

These sample programs will use Coaxlink by default. To use them with Grablink:

Similarly, to use Gigelink:

And for Playlink (which requires a license1):

Sample program Description Language OS
cpp/egrabber-snippets Collection of code snippets for eGrabber C++ Windows, Linux, macOS
cpp/display-latest-buffer Win32 application showing image acquisition and display, discarding buffers when processing is slower than image acquisition C++ Windows
cpp/egrabber-mfc MFC application showing image acquisition and display C++ Windows
cpp/sdl2/display-all-buffers SDL2 application showing image acquisition and display of all acquired buffers C++ Windows, Linux, macOS
cpp/sdl2/display-latest-buffer SDL2 application showing image acquisition and display, discarding buffers when processing is slower than image acquisition (using OnDemand callback model) C++ Windows, Linux, macOS
cpp/sdl2/display-latest-multipart SDL2 application showing image acquisition and display based on display-latest-buffer, suited to multi-part sources such as GenDC, discarding buffers when processing is slower C++ Windows, Linux, macOS
cpp/sdl2/display-latest-buffer-mt SDL2 application showing image acquisition and display, discarding buffers when processing is slower than image acquisition (using MultiThread callback model) C++ Windows, Linux, macOS
cpp/sdl2/egrabber-cuda-sdl2 SDL2 application showing image acquisition with eGrabber and processing with CUDA (on Nvidia GPU) Supported CUDA versions: v12.x, v13.x C++ Windows, Linux
cpp/amd-direct-gma OpenGL application showing image acquisition, direct transfer to AMD GPU memory, and display C++ Windows
cpp/nvidia-cuda OpenGL console application showing image acquisition with eGrabber and processing with CUDA (on Nvidia GPU) Supported CUDA versions: from v8.x up to v11.5 C++ Windows, Linux
cpp/ffc-wizard Console application showing how to compute coefficients for the Coaxlink FFC (flat-field correction) C++ Windows, Linux, macOS
cpp/grablink-serial-communication-mfc Simple application demonstrating Camera Link serial communication through the clseregl library on a Grablink Duo board C++ Windows
cs/egrabber Console application showing how to use eGrabber and callbacks in C# C# Windows
cs/grabn Console application showing image acquisition C# Windows
cs/grabn.NET .NET console application showing image acquisition C# Windows
cs/display-latest-buffer Windows Forms application showing image acquisition and display, discarding buffers when processing is slower than image acquisition C# Windows
cs/egrabber-wpf WPF application showing image acquisition and display C# Windows
cs/egrabber-cuda.NET .NET console application showing image acquisition with eGrabber and processing with CUDA (on Nvidia GPU) C# Windows, Linux
cs/*-recorder* Collection of sample programs eGrabber Recorder C# sample programs for eGrabber Recorder C# Windows
cs/grablink-serial-communication Simple application demonstrating Camera Link serial communication through the clseregl library on a Grablink Duo board C# Windows
python/* Collection of sample programs eGrabber Python sample programs for eGrabber Python Windows, Linux, macOS
python/*-recorder Collection of sample programs eGrabber Recorder Python sample programs for eGrabber Recorder Python Windows
python/display-all-buffers* Collection of extra sample programs eGrabber Python sample programs for eGrabber showing how to process acquired data with numpy, opencv, Pillow, etc. Python Windows, Linux, macOS
python/display-latest-buffer Simple application showing image acquisition and display, discarding buffers when processing is slower than image acquisition Python Windows, Linux, macOS
vb/grabn Console application showing image acquisition VB.NET Windows
vb/display-latest-buffer Windows Forms application showing image acquisition and display, discarding buffers when processing is slower than image acquisition VB.NET Windows
Additional files Description Language OS
tools/stripeGeometry.py Python script showing the effect of the image transfer settings: StripeArrangement, StripeHeight, StripePitch, StripeOffset, and BlockHeight Python Windows, Linux, macOS
LICENSE License text for eGrabber sample programs All Windows, Linux, macOS

eGrabber C++ code snippets

cpp/egrabber contains the following code snippets:

Snippet Description
100-grabn Simple Grab N frames using ScopedBuffer class
101-singleframe Single frame grabbing using ScopedBuffer class
102-action-grab Single frame triggered by an action
105-area-scan-grabn Set image size and Grab N frames (area-scan)
106-line-scan-grabn Set image size and Grab N frames (line-scan)
110-get-string-list Basic usage of EGrabber method getStringList
120-converter Measure FormatConverter speed
121-convert Buffer format conversions using ConvertedBuffer
130-using-buffer Simple Grab N frames using Buffer class
140-genapi-command Queries on GenApi commands
150-discover Discover and create eGrabbers or cameras with EGrabberDiscovery
200-grabn-callbacks Grab N frames and get DataStream events with callbacks
201-grabn-pop-oneof Grab N frames and get DataStream events using pop(OneOf<>)
210-show-all-grabbers Show available grabbers
211-show-all-grabbers-ro Show available grabbers (devices are opened with DEVICE_ACCESS_READONLY)
212-create-all-grabbers Create available grabbers
220-get-announced-handles Get info and handles of announced buffers
221-queue-buffer-ranges Create and use 2 sets of buffers configured differently
230-script-vars Pass data between native code and Euresys script
231-script-var Create and use virtual features from native code and Euresys scripts
240-user-memory Grab into user allocated buffer
241-multi-part Grab N multi-part buffers using Buffer class
250-using-lut Configure and enable the LUT processor
260-recorder-read-write Write/Read buffers to/from a Recorder container
261-recorder-parameters Show Recorder parameters
270-multicast-master Sending packets on multicast group
271-multicast-receiver Save the image received on the multicast group
300-events-mt-cic CIC events on EGrabber Multi-Thread Configuration
301-events-st-all All events on EGrabber Single-Thread Configuration
302-cxp-connector-detection Show CoaXPress events related to connection and device discovery
310-high-frame-rate Grab in high frame rate mode for 10 seconds
311-high-frame-rate Process images as soon as available in high frame rate mode for 10 seconds
312-part-timestamps Show timestamp of each buffer part in HFR mode
320-cl-serial-cli-genapi Command-line interface using GenApi commands for serial communication with a Camera Link camera
321-gencp-serial Simple Grab N frames with a GenCP camera
330-metadata-insertion Insert buffer and line metadata into a buffer and get them
340-dma-roi Grab N frames but store a smaller region in the user buffers
341-dma-deinterlace Grab and deinterlace N frames
342-dma-roi-deinterlace Grab N frames but store a deinterlaced smaller region in the user buffers
500-grabn-cuda-process Grab N frames and process them with CUDA operations
501-all-grabbers-cuda-process Use all available interfaces and devices to grab N frames and process them with CUDA operation
502-grabn-cuda-copy-and-process Grab N frames, copy the buffers to the CUDA device and process them with CUDA operations
503-grabn-cuda-rdma-process Grab N frames in the GPU memory with RDMA and process them with CUDA operations
504-grabn-cuda-dma-buf-fd-process Grab N frames in the GPU memory with DMA-BUF fd and process them with CUDA operations
600-thread-start-stop-callbacks Perform specific operations on a callback thread when it starts/stops
610-line-scan-array Array of (contiguous) buffers on Line-Scan with EGrabber Single-Thread
620-multiple-camera Acquire data from all cameras
650-multistream Acquire data from 4 data streams on the same device
700-memento Generate memento waves
800-process-latest-buffer Simulate a busy environment and acquire images, discarding some buffers when busy

eGrabber Python sample programs

Sample Description
100-grabn Simple Grab N using ‘with Buffer’
120-converter Python version of the C++ 120-converter eGrabber sample program
130-using-buffer Simple Grab N with manual buffer management
140-genapi-command Queries on GenApi commands
150-discover Discover and create eGrabbers or cameras with EGrabberDiscovery
200-grabn-callbacks Grab N frames and get DataStream events with callbacks
201-grabn-pop-oneof Grab N frames and get DataStream events with pop_one_of
210-show-all-grabbers Show available grabbers
240-user-memory Grab into user allocated buffer
300-events-mt Grab frames for a few seconds and get DataStream events with callbacks, processing them in a separate thread
310-high-frame-rate Grab in high frame rate mode for 10 seconds
320-cl-serial-cli-genapi Command-line interface using GenApi commands for serial communication with a Camera Link camera
322-cl-serial-cli-clseregl Command-line interface using the clseregl library for serial communication with a Camera Link camera
cuda-grab-and-invert Allocate an eGrabber buffer mapped into the CUDA device memory and run a kernel to invert its luminance values
cuda-rdma Allocate eGrabber buffers directly in a CUDA device memory using eGrabber NvidiaRdmaMemory
display-all-buffers-capture-opencv Acquire and convert frames to RGB8 to produce an avi file with opencv and numpy
display-all-buffers-numpy-opencv Create numpy arrays from acquired Mono8 data, transpose arrays and use opencv to show images
display-all-buffers Image acquisition and display
display-all-buffers-tkinter-pillow Simple tkinter application showing acquired data processed by a Pillow contour filter
display-latest-buffer Image acquisition and display. When the acquisition is faster than the display processing, buffers are discarded

eGrabber Recorder Python sample programs

Sample Description
260-recorder-read-write Write/Read buffers to/from a Recorder container
261-recorder-parameters Show Recorder parameters
262-recorder-export Export images from the container created by sample260.py to an MKV file, and then use opencv to read the MKV file and display the images
360-recorder-write-with-callback Write to a Recorder container using EGrabber callback

eGrabber Recorder C# sample programs

Sample Description
260-recorder-read-write Write/Read buffers to/from a Recorder container
261-recorder-parameters Show Recorder parameters

NVIDIA RDMA

NVIDIA RDMA is only suppported on Linux.

NVIDIA RDMA samples require an NVIDIA GPU that suppports RDMA.

The NVIDIA RDMA samples allocate memory on the GPU and announce this memory using NvidiaRdmaMemory.

See the following files in the eGrabber sample programs:

Preliminary note:

Please read the Supported Systems section and its IOMMUs subsection in https://docs.nvidia.com/cuda/gpudirect-rdma/index.html#supported-systems if the system on which the NVIDIA GPU is installed has an IOMMU.

The IOMMU may be disabled from the BIOS settings or via kernel command-line parameters (https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html).

NVIDIA RDMA support is only available with the Proprietary flavor of the NVIDIA drivers.

When the Proprietary version cannot be used, RDMA might be achived alternatively with Euresys DmaBufMemory.

An example of this alternative solution with the Open flavor is provided in the cpp/egrabber-snippets/samples/504-grabn-cuda-dma-buf-fd-process.cpp file from the eGrabber sample programs.

Installation instructions:

The line Enabling NVIDIA RDMA build should appear during the installation of the eGrabber package.

A successful build can be confirmed if the command lsmod | grep coaxlink (or lsmod | grep grablink) indicates that coaxlink (or grablink) module depends on nvidia.

DMA-BUF

DMA-BUF is only suppported on Linux.

The DMA-BUF sample requires an NVIDIA GPU that suppports DMA-BUF.

The NVIDIA DMA-BUF samples allocate memory on the GPU and announce this memory using DmaBufMemory.

See the following file in the eGrabber sample programs:

Preliminary note:

Please read the Supported Systems section and its IOMMUs subsection in https://docs.nvidia.com/cuda/gpudirect-rdma/index.html#supported-systems if the system on which the NVIDIA GPU is installed has an IOMMU.

The IOMMU may be disabled from the BIOS settings or via kernel command-line parameters (https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html).

When the Proprietary version of the NVIDIA driver cannot be used, RDMA might be achived alternatively with Euresys DmaBufMemory as long as the linux kernel supports DMA-BUF and the NVIDIA device supports the CU_DEVICE_ATTRIBUTE_DMA_BUF_SUPPORTED attribute, please check the NVIDIA documentation for more information.

Installation instructions:


  1. PC4401 eGrabber Recorder and Playlink or PC4401-EV eGrabber Recorder and Playlink (30-day evaluation).


© EURESYS S.A. - Subject to change without notice.