Supported devices: Gemini 330 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
ob::Pipeline pipe;
auto colorProfiles = pipe.getStreamProfileList(OB_SENSOR_COLOR);
if(colorProfiles) {
colorProfile = colorProfiles->getVideoStreamProfile(1280, OB_HEIGHT_ANY, OB_FORMAT_RGB, 30);
}
config->enableStream(colorProfile);
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>();
}
config->enableStream(depthProfile);
/* 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);
pipe.start(config);
auto colorFrame = frameSet->colorFrame();
auto depthFrame = frameSet->depthFrame();
auto newFrame = align.process(frameSet);
auto newFrameSet = newFrame->as<ob::FrameSet>();
colorFrame = newFrameSet->colorFrame();
depthFrame = newFrameSet->depthFrame();
pipe.stop();