# 流對齊處理單元-AlignFilterViewer
支持設(shè)備: Gemini 330系列相機(jī),例如:Gemini G335
功能描述:演示傳感器數(shù)據(jù)流同步對齊的操作,顯示對齊后的圖像,并通過ESC_KEY鍵退出程序
>本示例基于C++ hign Level API進(jìn)行演示
創(chuàng)建pipeline
ob::Pipeline pipe;
開啟color流
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);
設(shè)置對齊模式
/* 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);
開啟pipeline
pipe.start(config);
獲取幀數(shù)據(jù)
auto colorFrame = frameSet->colorFrame();
auto depthFrame = frameSet->depthFrame();
進(jìn)行對齊處理
aif(align_to_stream == OB_STREAM_COLOR) {
app.resize(colorFrame->width(), colorFrame->height());
}
else {
app.resize(depthFrame->width(), depthFrame->height());
}
關(guān)閉pipeline
pipe.stop();
預(yù)期輸出: