Documentation / Gemini 330 series /
C++ Sample Double Infrared Viewer

C++ Sample Double Infrared Viewer

Supported devices: Only supports Gemini 300 series, Gemini 2 XL, Gemini 2 VL

Function description: Demonstrate obtaining dual infrared camera images, displaying left and right infrared images, and exiting the program with the ESC_KEY key

| This example is based on the C++High Level API for demonstration

Create a pipeline to get devices

    ob::Pipeline pipe;

Configure Left IR

// Get the ir_left camera configuration list
auto irLeftProfiles = pipe.getStreamProfileList(OB_SENSOR_IR_LEFT);

if(irLeftProfiles == nullptr) {
    std::cerr
        << "The obtained IR(Left) resolution list is NULL. For monocular structured light devices, try opening the IR data stream using the IR example. "
        << std::endl;
    return 0;
}

// Open the default profile of IR_LEFT Sensor, which can be configured through the configuration file
try {
    auto irLeftProfile = irLeftProfiles->getProfile(OB_PROFILE_DEFAULT);
    config->enableStream(irLeftProfile->as<ob::VideoStreamProfile>());
}
catch(...) {
    std::cout << "IR(Left) stream not found!" << std::endl;
}

Configure Right IR

// Get the ir_right camera configuration list
auto irRightProfiles = pipe.getStreamProfileList(OB_SENSOR_IR_RIGHT);

// Open the default profile of IR_RIGHT Sensor, which can be configured through the configuration file
try {
    auto irRightProfile = irRightProfiles->getProfile(OB_PROFILE_DEFAULT);
    config->enableStream(irRightProfile->as<ob::VideoStreamProfile>());
}
catch(...) {
    std::cout << "IR(Right) stream not found!" << std::endl;
}

Open pipeline

pipe.start(config);

Get frame data

auto leftFrame  = frameSet->getFrame(OB_FRAME_IR_LEFT);
auto rightFrame = frameSet->getFrame(OB_FRAME_IR_RIGHT);

Stop pipeline

pipe.stop();

Expected Output

Stay updated

Be the first to learn about our new
products and updates.