OpenNI.Context.CreateProductionTree C# (CSharp) Method

CreateProductionTree() public method

public CreateProductionTree ( NodeInfo nodeInfo ) : OpenNI.ProductionNode
nodeInfo NodeInfo
return OpenNI.ProductionNode
        public ProductionNode CreateProductionTree(NodeInfo nodeInfo)
        {
            IntPtr nodeHandle;
            int status = SafeNativeMethods.xnCreateProductionTree(this.InternalObject, nodeInfo.InternalObject, out nodeHandle);
            WrapperUtils.ThrowOnError(status);
            return CreateProductionNodeObject(nodeHandle, nodeInfo.Description.Type);
        }

Usage Example

コード例 #1
0
        void Open(int i)
		{
			try
			{
				Close(i);


                OpenNIState state = FState[i];
                var context = new Context();
				FState[i].Context = context;
                context.AddLicense(FLicense);
                context.GlobalMirror = false;


                NodeInfoList list = context.EnumerateProductionTrees(global::OpenNI.NodeType.Device, null);
                NodeInfo node = null;
                if (FPinInNodes[i] != "")
                {
                    foreach (NodeInfo nodeitem in list)
                    {
                        if (nodeitem.CreationInfo == FPinInNodes[i])
                        {
                            node = nodeitem;
                            break;
                        }
                    }

                    if (node == null)
                        throw (new Exception("This device is unavailable. Check upstream ListDevices node"));

                    context.CreateProductionTree(node);
                }

                state.DepthGenerator = new DepthGenerator(context);
                MapOutputMode depthMode = new MapOutputMode();
                depthMode.FPS = 30;
                depthMode.XRes = 640;
                depthMode.YRes = 480;
                state.DepthGenerator.MapOutputMode = depthMode;
                state.DepthGenerator.StartGenerating();

                state.Start();

                FPinOutContext[i] = state;
                FPinOutStatus[i] = "OK";
			}
			catch (Exception e)
			{
				Close(i);
				FPinOutStatus[i] = e.Message;
			}
		}
All Usage Examples Of OpenNI.Context::CreateProductionTree