当前位置: 首页>>代码示例>>C#>>正文


C# Context.FindExistingNode方法代码示例

本文整理汇总了C#中OpenNI.Context.FindExistingNode方法的典型用法代码示例。如果您正苦于以下问题:C# Context.FindExistingNode方法的具体用法?C# Context.FindExistingNode怎么用?C# Context.FindExistingNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenNI.Context的用法示例。


在下文中一共展示了Context.FindExistingNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: xnInitialize

        // 初期化
        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();
        }
开发者ID:ninuxsoft,项目名称:KinectSensorProgramming,代码行数:29,代码来源:Form1_Recorder.cs

示例2: xnInitialize

        // 初期化
        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);

              // ユーザージェネレータの作成
              user = context.FindExistingNode(NodeType.User) as UserGenerator;
              if (depth == null) {
            throw new Exception(context.GlobalErrorState);
              }

              // ユーザー検出機能をサポートしているか確認
              if (!user.IsCapabilitySupported("User::Skeleton")) {
            throw new Exception("ユーザー検出をサポートしていません");
              }
        }
开发者ID:ninuxsoft,项目名称:KinectSensorProgramming,代码行数:33,代码来源:Form1_DrawUser.cs

示例3: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            try {
                // ContextとImageGeneratorの作成
                ScriptNode node;
                context = Context.CreateFromXmlFile( "../../SamplesConfig.xml", out node );
                context.GlobalMirror = true;
                image = context.FindExistingNode( NodeType.Image ) as ImageGenerator;
                depth = context.FindExistingNode( NodeType.Depth ) as DepthGenerator;
                depth.AlternativeViewpointCapability.SetViewpoint( image );

                // ユーザーの作成
                user = context.FindExistingNode( NodeType.User ) as UserGenerator;

                // ユーザー認識のコールバックを登録
                user.NewUser += new EventHandler<NewUserEventArgs>( user_NewUser );

                //キャリブレーションにポーズが必要か確認
                if ( user.SkeletonCapability.DoesNeedPoseForCalibration ) {
                    // ポーズ検出のサポートチェック
                    if ( !user.IsCapabilitySupported( "User::PoseDetection" ) ) {
                        throw new Exception( "ポーズ検出をサポートしていません" );
                    }

                    // ポーズ検出のコールバックを登録
                    user.PoseDetectionCapability.PoseDetected +=
                        new EventHandler<PoseDetectedEventArgs>( poseDetect_PoseDetected );
                }

                // スケルトン検出機能をサポートしているか確認
                if ( !user.IsCapabilitySupported( "User::Skeleton" ) ) {
                    throw new Exception( "ユーザー検出をサポートしていません" );
                }

                // キャリブレーションのコールバックを登録
                user.SkeletonCapability.CalibrationEnd +=
                    new EventHandler<CalibrationEndEventArgs>( skelton_CalibrationEnd );

                // すべてをトラッキングする
                user.SkeletonCapability.SetSkeletonProfile( SkeletonProfile.HeadAndHands );

                // ジェスチャーの検出開始
                context.StartGeneratingAll();

                // 画像更新のためのスレッドを作成
                shouldRun = true;
                readerThread = new Thread( new ThreadStart( ReaderThread ) );
                readerThread.Start();
            }
            catch ( Exception ex ) {
                MessageBox.Show( ex.Message );
            }
        }
开发者ID:kaorun55,项目名称:openni_sandbox,代码行数:55,代码来源:MainWindow.xaml.cs

示例4: InitOpenNI

        private void InitOpenNI()
        {
            // ContextとImageGeneratorの作成
            ScriptNode node;
            context = Context.CreateFromXmlFile( "SamplesConfig.xml", out node );
            context.GlobalMirror = false;
            image = context.FindExistingNode( NodeType.Image ) as ImageGenerator;

            // 画像更新のためのスレッドを作成
            shouldRun = true;
            readerThread = new Thread( new ThreadStart( () =>
            {
                while ( shouldRun ) {
                    context.WaitAndUpdateAll();
                    ImageMetaData imageMD = image.GetMetaData();

                    // ImageMetaDataをBitmapSourceに変換する(unsafeにしなくてもOK!!)
                    this.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action( () =>
                    {
                        imageOpenNI.Source = BitmapSource.Create( imageMD.XRes, imageMD.YRes,
                            96, 96, PixelFormats.Rgb24, null, imageMD.ImageMapPtr,
                            imageMD.DataSize, imageMD.XRes * imageMD.BytesPerPixel );
                    } ) );
                }
            } ) );
            readerThread.Start();
        }
开发者ID:kaorun55,项目名称:kinect_sdk_sandbox,代码行数:27,代码来源:MainWindow.xaml.cs

示例5: Run

        static void Run()
        {
            string SAMPLE_XML_FILE = @"../../../../Data/SamplesConfig.xml";

            Context context = new Context(SAMPLE_XML_FILE);

            DepthGenerator depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            if (depth == null)
            {
                Console.WriteLine("Sample must have a depth generator!");
                return;
            }

            MapOutputMode mapMode = depth.MapOutputMode;

            DepthMetaData depthMD = new DepthMetaData();

            Console.WriteLine("Press any key to stop...");

            while (!Console.KeyAvailable)
            {
                context.WaitOneUpdateAll(depth);

                depth.GetMetaData(depthMD);

                Console.WriteLine("Frame {0} Middle point is: {1}.", depthMD.FrameID, depthMD[(int)mapMode.XRes/2, (int)mapMode.YRes/2]);
            }
        }
开发者ID:nemesit,项目名称:OpenNI,代码行数:28,代码来源:Program.cs

示例6: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            this.context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);
            this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            if (this.depth == null)
            {
                throw new Exception("Viewer must have a depth node!");
            }

            this.userGenerator = new UserGenerator(this.context);
            this.skeletonCapbility = this.userGenerator.SkeletonCapability;
            this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability;
            this.calibPose = this.skeletonCapbility.CalibrationPose;

            this.userGenerator.NewUser += userGenerator_NewUser;
            this.userGenerator.LostUser += userGenerator_LostUser;
            this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected;
            this.skeletonCapbility.CalibrationComplete += skeletonCapbility_CalibrationComplete;

            this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All);
            this.joints = new Dictionary<int,Dictionary<SkeletonJoint,SkeletonJointPosition>>();
            this.userGenerator.StartGenerating();

            this.histogram = new int[this.depth.DeviceMaxDepth];

            MapOutputMode mapMode = this.depth.MapOutputMode;

            this.bitmap = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes/*, System.Drawing.Imaging.PixelFormat.Format24bppRgb*/);
            this.shouldRun = true;
            this.readerThread = new Thread(ReaderThread);
            this.readerThread.Start();
        }
开发者ID:wair,项目名称:Patched_Kinect_Drivers_for_Ubuntu,代码行数:34,代码来源:MainWindow.cs

示例7: HandSensor

        public HandSensor(Context context)
        {
            this.context = context;

            gestureGenerator = context.FindExistingNode(NodeType.Gesture) as GestureGenerator;
            handsGenerator = context.FindExistingNode(NodeType.Hands) as HandsGenerator;

            gestureGenerator.GestureRecognized += new EventHandler<GestureRecognizedEventArgs>(gestureGenerator_GestureRecognized);

            handsGenerator.HandCreate += new EventHandler<HandCreateEventArgs>(handsGenerator_HandCreate);
            handsGenerator.HandDestroy += new EventHandler<HandDestroyEventArgs>(handsGenerator_HandDestroy);
            handsGenerator.HandUpdate += new EventHandler<HandUpdateEventArgs>(handsGenerator_HandUpdate);

            handsGenerator.StartGenerating();
            gestureGenerator.AddGesture("Wave");

            string[] s = gestureGenerator.EnumerateAllGestures();

            Trace.WriteLine("HandSensor initialized");
        }
开发者ID:wandermyz,项目名称:KinectGestures,代码行数:20,代码来源:HandSensor.cs

示例8: xnInitialize

        // 初期化
        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);
              }
        }
开发者ID:ninuxsoft,项目名称:KinectSensorProgramming,代码行数:21,代码来源:Form1_Depth.cs

示例9: Kinect

        //Constructor Method
        //Starts up necessary files to take data
        Kinect()
        {
            //Sets locations of XML File
            string SAMPLE_XML_FILE = @"C:\Users\CenSISS\Documents\Kinect Project\SamplesConfig.xml";

            //Declares object of ScriptNode and defines context
            ScriptNode scriptNode;
            context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);

            //Declares the depth generator
            DepthGenerator depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            //If the depth generator does not exist returns error messag
            if (depth == null)
            {
                Console.WriteLine("Sample must have a depth generator!");
                Console.ReadLine();
                return;
            }
        }
开发者ID:neilkdave,项目名称:Kinect-Lymphedema-Screening-Code,代码行数:21,代码来源:RunKinect.cs

示例10: KinectManager

        public KinectManager()
        {
            try
            {
                _context = new Context(@"..\..\Data\openniconfig.xml");
                _depth_generator = _context.FindExistingNode(NodeType.Depth) as DepthGenerator;
                if (_depth_generator == null)
                    throw new Exception(@"Error in Data\openniconfig.xml - No depth node found.");

                _user_generator = new UserGenerator(_context);
                _skeleton_caps = _user_generator.SkeletonCapability;
                _pose_detect_caps = _user_generator.PoseDetectionCapability;
                _calibration_pose = _skeleton_caps.CalibrationPose;

                // event handler for detection
                _user_generator.NewUser += (_user_generator_NewUser);
                _user_generator.LostUser += (_user_generator_LostUser);
                _pose_detect_caps.PoseDetected += (_pose_detect_caps_PoseDetected);
                _skeleton_caps.CalibrationEnd += (_skeleton_caps_CalibrationEnd);

                _skeleton_caps.SetSkeletonProfile(SkeletonProfile.All);

                // initialize joints
                _joints = new Dictionary<int, Dictionary<SkeletonJoint, SkeletonJointPosition>>();
                _joint_orientation = new Dictionary<int, Dictionary<SkeletonJoint, SkeletonJointOrientation>>();

                // start generating data
                _user_generator.StartGenerating();

            }catch(Exception ex)
            {
                Console.WriteLine("Error initializing OpenNi.");
                Console.WriteLine(ex.Message);
            }

            // update timer for the depth image
            DispatcherTimer dispatcher_timer = new DispatcherTimer();
            dispatcher_timer.Tick += new EventHandler(dispatcher_timer_Tick);
            dispatcher_timer.Interval = new TimeSpan(0, 0, 0, 0, 10); // update every 10 ms
            dispatcher_timer.Start();
            Console.WriteLine("Finished loading");
        }
开发者ID:justkarli,项目名称:DxPracticeEngine,代码行数:42,代码来源:KinectManager.cs

示例11: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            this.context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);
            this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            if (this.depth == null)
            {
                throw new Exception("Viewer must have a depth node!");
            }

            this.histogram = new int[this.depth.DeviceMaxDepth];

            MapOutputMode mapMode = this.depth.MapOutputMode;

            this.bitmap = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            this.shouldRun = true;
            this.readerThread = new Thread(ReaderThread);
            this.readerThread.Start();
        }
开发者ID:zhangxaochen,项目名称:openni1x-samples,代码行数:20,代码来源:MainWindow.cs

示例12: xnInitialize

        // 初期化
        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);
            throw new Exception("イメージジェネレータの作成に失敗");
              }

              cropping.Enabled= false;
              cropping.XOffset = 0;
              cropping.YOffset = 0;
              cropping.XSize = 500;
              cropping.YSize = 450;
        }
开发者ID:ninuxsoft,项目名称:KinectSensorProgramming,代码行数:21,代码来源:Form1_CroppingCapability.cs

示例13: Kinect

        //Starts up necessary files to take data
        //Must run before TakeData()
        Kinect()
        {
            //Sets locations of XML File
            string SAMPLE_XML_FILE = @"..\\..\\..\\SamplesConfig.xml";

            //Declares object of ScriptNode and defines context
            ScriptNode scriptNode;
            context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);

            //Declares the depth generator
            depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            //If the depth generator does not exist returns error messag
            if (depth == null)
            {
                Console.WriteLine("Sample must have a depth generator!");
                Console.ReadLine();
                return;
            }
            //Declares necessary variables and classes to take depth
            //DepthGenerator depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            mapMode = depth.MapOutputMode;
            depthMD = new DepthMetaData();
        }
开发者ID:neilkdave,项目名称:Kinect-Lymphedema-Screening-Code,代码行数:25,代码来源:Program.cs

示例14: xnInitialize

        // 初期化
        private void xnInitialize()
        {
            // コンテキストの初期化
              context = new Context();
              // OpenFileRecordingExを使うように促されるが、使用するとアクセスバイオレーションになる
              context.OpenFileRecording(RECORD_PATH);

              // プレーヤーの作成
              player = context.FindExistingNode(NodeType.Player) as OpenNI.Player;
              if (player == null) {
            throw new Exception(context.GlobalErrorState);
              }

              // 終端に達したら通知するコールバックを登録する
              player.EndOfFileReached += new EventHandler(player_EndOfFileReached);

              // イメージジェネレータの作成
              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);
              }

              // ヒストグラムバッファの作成
              histogram = new int[depth.DeviceMaxDepth];
        }
开发者ID:ninuxsoft,项目名称:KinectSensorProgramming,代码行数:32,代码来源:Form1_Player.cs

示例15: Initialize

 private void Initialize()
 {
     ScriptNode scriptNode;
     this.context = Context.CreateFromXmlFile(SAMPLE_XML_FILE, out scriptNode);
     this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
     if (this.depth == null)
     {
         throw new Exception("Viewer must have a depth node!");
     }
     this.userGenerator = new UserGenerator(this.context);
     this.skeletonCapbility = this.userGenerator.SkeletonCapability;
     this.userGenerator.NewUser += this.OnUserGeneratorNewUser;
     this.userGenerator.LostUser += this.OnUserGeneratorLostUser;
     this.skeletonCapbility.CalibrationComplete += this.OnSkeletonCapbilityCalibrationComplete;
     this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All);
     this.joints = new Dictionary<int, Dictionary<SkeletonJoint, SkeletonJointPosition>>();
     this.userGenerator.StartGenerating();
 }
开发者ID:vgebrev,项目名称:Velismatic,代码行数:18,代码来源:UserTracker.cs


注:本文中的OpenNI.Context.FindExistingNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。