本文整理汇总了C++中xn::Context::CreateAnyProductionTree方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::CreateAnyProductionTree方法的具体用法?C++ Context::CreateAnyProductionTree怎么用?C++ Context::CreateAnyProductionTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xn::Context
的用法示例。
在下文中一共展示了Context::CreateAnyProductionTree方法的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: StartCapture
void StartCapture()
{
char recordFile[256] = {0};
time_t rawtime;
struct tm *timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
XnUInt32 size;
xnOSStrFormat(recordFile, sizeof(recordFile)-1, &size,
"%d_%02d_%02d[%02d_%02d_%02d].oni",
timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
if (g_pRecorder != NULL)
{
StopCapture();
}
XnStatus nRetVal = XN_STATUS_OK;
g_pRecorder = new xn::Recorder;
g_Context.CreateAnyProductionTree(XN_NODE_TYPE_RECORDER, NULL, *g_pRecorder);
START_CAPTURE_CHECK_RC(nRetVal, "Create recorder");
nRetVal = g_pRecorder->SetDestination(XN_RECORD_MEDIUM_FILE, recordFile);
START_CAPTURE_CHECK_RC(nRetVal, "set destination");
nRetVal = g_pRecorder->AddNodeToRecording(g_DepthGenerator, XN_CODEC_16Z_EMB_TABLES);
START_CAPTURE_CHECK_RC(nRetVal, "add node");
g_bRecord = true;
}