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:

either define EURESYS_DEFAULT_GENTL_PRODUCER=grablink in your environment;
or pass Grablink() to the EGenTL constructor.

Similarly, to use Gigelink (which requires a license1:

either define EURESYS_DEFAULT_GENTL_PRODUCER=gigelink in your environment;
or pass Gigelink() to the EGenTL constructor.

And for Playlink (which also requires a license2):

either define EURESYS_DEFAULT_GENTL_PRODUCER=playlink in your environment;
or pass Playlink() to the EGenTL constructor.

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-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)

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)

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/exif

Collection of of sample programs showing how to use the Coaxlink Quad CXP-12 JPEG and how to embed metadata in EXIF files

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/*-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 eGrabber Python sample programs for eGrabber

Python

Windows, Linux, macOS

python/*-recorder

Collection of eGrabber Recorder Python sample programs

Python

Windows

python/display-all-buffers*

Collection of extra 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
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 Command line interface 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
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

EXIF sample programs

cpp/exif contains the following samples:

Sample Description
100-jpeg-exif Acquire data from 4 JPEG encoded data streams and produce EXIF files
200-jpeg-preview-exif Acquire data from 4 Preview and 4 JPEG encoded data streams and produce EXIF files with thumbnails

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 Command line interface for serial communication with a Camera Link camera
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