本文整理汇总了C++中xn::DepthGenerator::GetFrameSyncCap方法的典型用法代码示例。如果您正苦于以下问题:C++ DepthGenerator::GetFrameSyncCap方法的具体用法?C++ DepthGenerator::GetFrameSyncCap怎么用?C++ DepthGenerator::GetFrameSyncCap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xn::DepthGenerator
的用法示例。
在下文中一共展示了DepthGenerator::GetFrameSyncCap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConfigureGenerators
XnStatus ConfigureGenerators(const RecConfiguration& config, xn::Context& context, xn::DepthGenerator& depthGenerator, xn::ImageGenerator& imageGenerator)
{
XnStatus nRetVal = XN_STATUS_OK;
xn::EnumerationErrors errors;
// Configure the depth, if needed
if (config.bRecordDepth)
{
nRetVal = context.CreateAnyProductionTree(XN_NODE_TYPE_DEPTH, NULL, depthGenerator, &errors);
CHECK_RC_ERR(nRetVal, "Create Depth", errors);
nRetVal = depthGenerator.SetMapOutputMode(*config.pDepthMode);
CHECK_RC(nRetVal, "Set Mode");
if (config.bMirrorIndicated && depthGenerator.IsCapabilitySupported(XN_CAPABILITY_MIRROR))
{
depthGenerator.GetMirrorCap().SetMirror(config.bMirror);
}
// Set Hole Filter
depthGenerator.SetIntProperty("HoleFilter", TRUE);
}
// Configure the image, if needed
if (config.bRecordImage)
{
nRetVal = context.CreateAnyProductionTree(XN_NODE_TYPE_IMAGE, NULL, imageGenerator, &errors);
CHECK_RC_ERR(nRetVal, "Create Image", errors);
nRetVal = imageGenerator.SetMapOutputMode(*config.pImageMode);
CHECK_RC(nRetVal, "Set Mode");
if (config.bMirrorIndicated && imageGenerator.IsCapabilitySupported(XN_CAPABILITY_MIRROR))
{
imageGenerator.GetMirrorCap().SetMirror(config.bMirror);
}
}
// Configuration for when there are both streams
if (config.bRecordDepth && config.bRecordImage)
{
// Registration
if (config.bRegister && depthGenerator.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT))
{
nRetVal = depthGenerator.GetAlternativeViewPointCap().SetViewPoint(imageGenerator);
CHECK_RC(nRetVal, "Registration");
}
// Frame Sync
if (config.bFrameSync && depthGenerator.IsCapabilitySupported(XN_CAPABILITY_FRAME_SYNC))
{
if (depthGenerator.GetFrameSyncCap().CanFrameSyncWith(imageGenerator))
{
nRetVal = depthGenerator.GetFrameSyncCap().FrameSyncWith(imageGenerator);
CHECK_RC(nRetVal, "Frame sync");
}
}
}
return XN_STATUS_OK;
}
示例2: init
bool OpenNIVideo::init() {
//open the video
//if you are using a device, you can open the device
//if you are using video streaming, you can initialize the connection
//if you are using video files, you can read the configuration, cache the data, etc.
xn::EnumerationErrors errors;
int resolutionX = 640;
int resolutionY = 480;
unsigned int FPS = 30;
XnStatus nRetVal = XN_STATUS_OK;
nRetVal = context.Init();
CHECK_RC(nRetVal, "context global init");
//xn::NodeInfoList list;
//nRetVal = context.EnumerateProductionTrees(XN_NODE_TYPE_DEVICE, NULL, list, &errors);
//CHECK_RC(nRetVal, "enumerate production tree");
// HandsGenerator hands;
//UserGenerator user;
//GestureGenerator gesture;
//SceneAnalyzer scene;
nRetVal = depth_generator.Create(context);
CHECK_RC(nRetVal, "creating depth generator");
nRetVal = image_generator.Create(context);
CHECK_RC(nRetVal, "creating image generator");
if(depth_generator.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT))
{
nRetVal = depth_generator.GetAlternativeViewPointCap().SetViewPoint(image_generator);
CHECK_RC(nRetVal, "creating registered image/depth generator");
}
else
{
printf("WARNING: XN_CAPABILITY_ALTERNATIVE_VIEW_POINT not supported");
}
if (depth_generator.IsCapabilitySupported(XN_CAPABILITY_FRAME_SYNC))
{
if( depth_generator.GetFrameSyncCap().CanFrameSyncWith(image_generator)) {
//nRetVal=depth.GetFrameSyncCap().FrameSyncWith(image);
//CHECK_RC(nRetVal, "creating frame sync image/depth generator");
}
}
else
{
printf("WARNING: XN_CAPABILITY_FRAME_SYNC not supported");
}
XnMapOutputMode mode = {resolutionX,resolutionY,FPS};
nRetVal = depth_generator.SetMapOutputMode(mode);
CHECK_RC(nRetVal, "set output mode");
//NOT NEEDED IF SYNCHRO
nRetVal = image_generator.SetMapOutputMode(mode);
CHECK_RC(nRetVal, "set output mode");
_depthBufferShort=new unsigned short[resolutionX*resolutionY];
_depthBufferByte=new unsigned char[resolutionX*resolutionY];
//we need to create one video stream
_videoStreamList.push_back(new osgART::VideoStream());
_videoStreamList[0]->allocateImage(resolutionX,resolutionY, 1, GL_RGB, GL_UNSIGNED_BYTE);
//we need to create one video stream
_videoStreamList.push_back(new osgART::VideoStream());
// _videoStreamList[1]->allocateImage(resolutionX,resolutionY, 1, GL_LUMINANCE, GL_FLOAT);
_videoStreamList[1]->allocateImage(resolutionX,resolutionY, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);
//_videoStreamList[1]->allocateImage(resolutionX,resolutionY, 1, GL_LUMINANCE, GL_UNSIGNED_SHORT);
//_videoStreamList[1]->allocateImage(w, h, 1, GL_DEPTHCOMPONENT16, GL_UNSIGNED_BYTE);
if (m_flip_vertical)
{
_videoStreamList[0]->flipVertical();
_videoStreamList[1]->flipVertical();
}
if (m_flip_horizontal)
{
_videoStreamList[0]->flipHorizontal();
_videoStreamList[1]->flipHorizontal();
}
return true;
}