Documentation Portal      

What are you looking for?

Configuring the grabber

Configuration is a very important aspect of any image acquisition program.

The camera and the frame grabber both have to be configured according to the application requirements.
The camera configuration must be compatible with the frame grabber configuration, and vice versa.

Configuration basically boils down to a series of set/get operations performed on the grabber modules: the remote device (i.e., the camera), the interface, the device, or the data stream modules.

This program configures the grabber for the so-called RG control mode (asynchronous reset camera control, frame grabber-controlled exposure).

#include <iostream>
#include <EGrabber.h>

const double FPS = 150;

void configure() {
    Euresys::EGenTL gentl;
    Euresys::EGrabber<> grabber(gentl);
    // camera configuration
    grabber.setString<Euresys::RemoteModule>("TriggerMode", "On");                      // 1
    grabber.setString<Euresys::RemoteModule>("TriggerSource", "CXPin");                 // 2
    grabber.setString<Euresys::RemoteModule>("ExposureMode", "TriggerWidth");           // 3
    // frame grabber configuration
    grabber.setString<Euresys::DeviceModule>("CameraControlMethod", "RG");              // 4
    grabber.setString<Euresys::DeviceModule>("CycleTriggerSource", "Immediate");        // 5
    grabber.setFloat<Euresys::DeviceModule>("CycleMinimumPeriod", 1e6 / FPS);           // 6
}

int main() {
    try {
        configure();
    } catch (const std::exception &e) {
        std::cout << "error: " << e.what() << std::endl;
    }
}
1. Enable triggers on the camera.
2. Tell the camera to look for triggers on the CoaXPress link.
3. Configure the camera to use the TriggerWidth exposure mode.
4. Set the frame grabber's camera control method to RG. In this mode, camera cycles are initiated by the frame grabber, and the exposure duration is also controlled by the frame grabber.
5. Tell the frame grabber to initiate camera cycles itself (at a rate defined by CycleMinimumPeriod), without waiting for hardware or software triggers.
6. Configure the frame rate.

But there is a better way to configure the grabber. Using a script file, the program becomes:

#include <iostream>
#include <EGrabber.h>

void configure() {
    Euresys::EGenTL gentl;
    Euresys::EGrabber<> grabber(gentl);
    grabber.runScript("config.js");
}

int main() {
    try {
        configure();
    } catch (const std::exception &e) {
        std::cout << "error: " << e.what() << std::endl;
    }
}

and the configuration script is:


var grabber = grabbers[0];
var FPS = 150;
// camera configuration
grabber.RemotePort.set("TriggerMode", "On");
grabber.RemotePort.set("TriggerSource", "CXPin");
grabber.RemotePort.set("ExposureMode", "TriggerWidth");
// frame grabber configuration
grabber.DevicePort.set("CameraControlMethod", "RG");
grabber.DevicePort.set("CycleTriggerSource", "Immediate");
grabber.DevicePort.set("CycleMinimumPeriod", 1e6 / FPS);

Using a script file has several advantages:

The configuration can be changed without recompiling the application. This allows shorter development cycles, and makes it possible to update the configuration in the lab or in the field.
The configuration script can be loaded by the GenICam Browser and the command-line gentl tool. This makes is possible to validate the configuration outside of the user application.
The configuration script can easily be shared by several applications written in different programming languages: C++, C#, VB.NET...
The full power of Euresys GenApi scripts is available.

© 2019EURESYS s.a.  -  About Documentation  -  Coaxlink 10.5.2.2065