Documentation / Gemini 330 series /
C++ Sample Align Filter Viewer

C++ Sample Align Filter Viewer

Supported devices: G300 series cameras, such as Gemini G335

Function description: Demonstrate the synchronization and alignment of sensor data streams, display the aligned image, and exit the program using the ESC_KEY key

| This example is based on the C++high level API for demonstration

Create pipeline

ob::Pipeline pipe;

Enable color stream

auto colorProfiles = pipe.getStreamProfileList(OB_SENSOR_COLOR);
if(colorProfiles) {
    colorProfile = colorProfiles->getVideoStreamProfile(1280, OB_HEIGHT_ANY, OB_FORMAT_RGB, 30);

Enable depth stream

auto                                    depthProfiles = pipe.getStreamProfileList(OB_SENSOR_DEPTH);
std::shared_ptr<ob::VideoStreamProfile> depthProfile  = nullptr;
if(depthProfiles) {
depthProfile = depthProfiles->getVideoStreamProfile(640, OB_HEIGHT_ANY, OB_FORMAT_Y16, 30);
//depthProfile = std::const_pointer_cast<ob::StreamProfile>(depthProfiles->getProfile(OB_PROFILE_DEFAULT))->as<ob::VideoStreamProfile>();

Set alignment mode

/* Config depth align to color or color align to depth.
OBStreamType align_to_stream = OB_STREAM_DEPTH; */
OBStreamType align_to_stream = OB_STREAM_COLOR;
ob::Align align(align_to_stream);

Open pipeline


Get frame data

auto colorFrame = frameSet->colorFrame();
auto depthFrame = frameSet->depthFrame();

Perform alignment processing

aif(align_to_stream == OB_STREAM_COLOR) {
    app.resize(colorFrame->width(), colorFrame->height());
else {
    app.resize(depthFrame->width(), depthFrame->height());

Close pipeline


Expected Output

Stay updated

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