OpenNI.Context.FindExistingNode C# (CSharp) Method

FindExistingNode() public method

public FindExistingNode ( NodeType type ) : ProductionNode
type NodeType
return ProductionNode
        public ProductionNode FindExistingNode(NodeType type)
        {
            IntPtr nodeHandle;
            int status = SafeNativeMethods.xnFindExistingRefNodeByType(this.InternalObject, type, out nodeHandle);
            if (status != 0)
            {
                return null;
            }

            ProductionNode node = CreateProductionNodeObject(nodeHandle, type);

            // release the handle
            SafeNativeMethods.xnProductionNodeRelease(nodeHandle);

            return node;
        }

Usage Example

コード例 #1
0
        // 初期化
        private void xnInitialize()
        {
            // コンテキストの初期化
              ScriptNode scriptNode;
              context = Context.CreateFromXmlFile( CONFIG_XML_PATH, out scriptNode );

              // イメージジェネレータの作成
              image = context.FindExistingNode(NodeType.Image) as ImageGenerator;
              if (image == null) {
            throw new Exception(context.GlobalErrorState);
              }

              // デプスジェネレータの作成
              depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
              if (depth == null) {
            throw new Exception(context.GlobalErrorState);
              }

              // デプスの座標をイメージに合わせる
              depth.AlternativeViewpointCapability.SetViewpoint(image);

              // レコーダーの作成と記録対象の追加
              recoder = new OpenNI.Recorder(context);
              recoder.SetDestination(RecordMedium.File, RECORD_PATH);
              recoder.AddNodeToRecording(image);
              recoder.AddNodeToRecording(depth);
              recoder.Record();
        }
All Usage Examples Of OpenNI.Context::FindExistingNode