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


C# SkeletonFrameReadyEventArgs类代码示例

本文整理汇总了C#中SkeletonFrameReadyEventArgs的典型用法代码示例。如果您正苦于以下问题:C# SkeletonFrameReadyEventArgs类的具体用法?C# SkeletonFrameReadyEventArgs怎么用?C# SkeletonFrameReadyEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: nui_SkeletonFrameReady

        void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            SkeletonFrame allSkeletons = e.SkeletonFrame;

            //get the first tracked skeleton
            SkeletonData skeleton = (from s in allSkeletons.Skeletons
                                     where s.TrackingState == SkeletonTrackingState.Tracked
                                     select s).FirstOrDefault();
            if (skeleton != null)
            {
                this._skel = skeleton;
                Joint head = skeleton.Joints[JointID.Head];
                HumanSkeleton hs = new HumanSkeleton(skeleton.Joints);
                NaoSkeleton ns = new NaoSkeleton(hs);
                UpdateTextBoxes(ns, hs);
                controller.update(ns);

                SetLineAngle(RightArmTopDown, Util.radToDeg(hs.RightShoulderYaw));
                SetLineAngle(LeftArmTopDown, Util.radToDeg(hs.LeftShoulderYaw));
                SetLineAngle(RightArmFront, Util.radToDeg(-hs.RightShoulderPitch) + 90);
                SetLineAngle(LeftArmFront, Util.radToDeg(hs.LeftShoulderPitch) - 90);
                SetLineAngle(RightArm, Util.radToDeg(-hs.RightShoulderRoll) + 90);
                SetLineAngle(LeftArm, Util.radToDeg(hs.LeftShoulderRoll) - 90);
            }
        }
开发者ID:omanamos,项目名称:kinect-nao,代码行数:25,代码来源:MainWindow.xaml.cs

示例2: kinectRuntime_SkeletonFrameReady

        void kinectRuntime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            SkeletonFrame skeletonFrame = e.SkeletonFrame;

            foreach (SkeletonData data in skeletonFrame.Skeletons)
            {
                if (data.TrackingState != SkeletonTrackingState.Tracked)
                    continue;

                barycenterHelper.Add(data.Position.ToVector3(),data.TrackingID);
                if (!barycenterHelper.IsStable(data.TrackingID))
                    continue;

                foreach (Joint joint in data.Joints)
                {
                    if (joint.Position.W < 0.8f || joint.TrackingState != JointTrackingState.Tracked)
                        continue;

                    if (joint.ID == JointID.HandRight)
                    {
                        rightHandGestureRecognizer.Add(joint.Position, kinectRuntime.SkeletonEngine);
                        Trace.WriteLine(Gesture.Content = "HandRight.Add");
                    }
                }

                // ポーズの検出
                postureRecognizer.TrackPostures(data);
            }

            // スケルトンの描画
            skeletonDisplayManager.Draw(e.SkeletonFrame);

            labelPose.Content = "Pose: " + postureRecognizer.CurrentPosture.ToString();
        }
开发者ID:kaorun55,项目名称:kinect_sdk_sandbox,代码行数:34,代码来源:MainWindow.xaml.cs

示例3: runtime_SkeletonFrameReady

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void runtime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            SkeletonFrame skeletonSet = e.SkeletonFrame;

            SkeletonData data = (from s in skeletonSet.Skeletons
                                 where s.TrackingState == SkeletonTrackingState.Tracked
                                 select s).FirstOrDefault();

            SetEllipsePosition(head, data.Joints[JointID.Head]);
            SetEllipsePosition(leftHand, data.Joints[JointID.HandLeft]);
            SetEllipsePosition(rightHand, data.Joints[JointID.HandRight]);

            // draw joints
            Joint headjoint = data.Joints[JointID.Head];

            Joint leftShoulderJoint = data.Joints[JointID.ShoulderLeft];
            Joint centerShoulderJoint = data.Joints[JointID.ShoulderCenter];
            Joint rightShoulderJoint = data.Joints[JointID.ShoulderRight];

            Joint spineJoint = data.Joints[JointID.Spine];

            Joint leftWristJoint = data.Joints[JointID.WristLeft];
            Joint rightWristJoint = data.Joints[JointID.WristRight];

            Joint leftHandJoint = data.Joints[JointID.HandLeft];
            Joint rightHandJoint = data.Joints[JointID.HandRight];

            // draw skeleton
        }
开发者ID:justzx2011,项目名称:KinectGallery,代码行数:34,代码来源:KinectWindow.xaml.cs

示例4: nui_SkeletonFrameReady

        public void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            if (!IsRecording) return;

            lock (RecordStream)
            {
                SkeletonFrame skeletonFrame = e.SkeletonFrame;
                int iSkeleton = 0;

                foreach (SkeletonData data in skeletonFrame.Skeletons)
                {
                    if (SkeletonTrackingState.Tracked == data.TrackingState)
                    {
                        //Recording for longer than a day will cause the timer to roll over.  Who would record 24+ hours of Kinect data anyways?
                        TimeSpan elapsedTime = DateTime.Now - StartTime;
                        RecordStream.Write(elapsedTime.Hours.ToString() + ":" + elapsedTime.Minutes.ToString() + ":" + elapsedTime.Seconds.ToString() + ":" + elapsedTime.Milliseconds.ToString() + ",");
                        foreach (Joint joint in data.Joints)
                        {
                            RecordStream.Write(joint.ID.ToString() + "," + (joint.Position.X * 1000).ToString() + "," + (joint.Position.Y * 1000) + "," + (joint.Position.Z * 1000)+",");
                        }
                        RecordStream.WriteLine("");
                     }
                    iSkeleton++;
                } // for each skeleton
            }
        }
开发者ID:Jerdak,项目名称:KinectDaemon,代码行数:26,代码来源:Recorder.cs

示例5: xtion_SkeletonFrameReady

        void xtion_SkeletonFrameReady( object sender, SkeletonFrameReadyEventArgs e )
        {
            this.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action( () =>
            {
                canvas1.Children.Clear();

                foreach ( var u in e.Users ) {
                    if ( !e.Skeleton.IsTracking( u ) ) {
                        continue;
                    }

                    foreach ( SkeletonJoint s in Enum.GetValues( typeof( SkeletonJoint ) ) ) {
                        if ( !e.Skeleton.IsJointAvailable( s ) || !e.Skeleton.IsJointActive( s ) ) {
                            continue;
                        }

                        var joint = e.Skeleton.GetSkeletonJoint( u, s );
                        var point = e.DepthGenerator.ConvertRealWorldToProjective( joint.Position.Position );
                        point  = point.ScaleTo( e.DepthGenerator, 320, 240 );

                        const int dimeter = 10;
                        const int r = dimeter / 2;
                        canvas1.Children.Add( new Ellipse()
                        {
                            Fill = Brushes.Red,
                            Margin = new Thickness( point.X - r, point.Y - r, point.X + r, point.Y + r ),
                            Height = dimeter,
                            Width = dimeter,
                        } );
                    }
                }
            } ) );
        }
开发者ID:kaorun55,项目名称:OpenNI.Toolkit,代码行数:33,代码来源:MainWindow.xaml.cs

示例6: kinectRuntime_SkeletonFrameReady

 private void kinectRuntime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
 {
     if (e.SkeletonFrame == null)
         return;
     if (!e.SkeletonFrame.Skeletons.Any(s => s.TrackingState != SkeletonTrackingState.NotTracked))
         return;
     ProcessFrame(e.SkeletonFrame);
 }
开发者ID:geopoulos,项目名称:KinectGestureDectection,代码行数:8,代码来源:MainWindow.xaml.cs

示例7: KinectRuntime_SkeletonFrameReady

        private void KinectRuntime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            SkeletonFrame allSkeletons = e.SkeletonFrame;

            // Get the first tracked skeleton.
            skeleton.SkeletonData = (from s in allSkeletons.Skeletons
                                     where s.TrackingState == SkeletonTrackingState.Tracked
                                     select s).FirstOrDefault();
        }
开发者ID:NashDotNet,项目名称:Intro-to-Developing-for-the-Kinect,代码行数:9,代码来源:MainWindow.xaml.cs

示例8: kinectRuntime_SkeletonFrameReady

        void kinectRuntime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            if (recorder != null)
                recorder.Record(e.SkeletonFrame);

            if (e.SkeletonFrame.Skeletons.Where(s => s.TrackingState != SkeletonTrackingState.NotTracked).Count() == 0)
                return;

            ProcessFrame(e.SkeletonFrame);
        }
开发者ID:salivian,项目名称:LazyHH,代码行数:10,代码来源:MainWindow.xaml.cs

示例9: runtime_SkeletonFrameReady

        void runtime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            var skeleton = e.SkeletonFrame.Skeletons.Where(s => s.TrackingState == SkeletonTrackingState.Tracked).FirstOrDefault();

            if (skeleton != null && this.SkeletonUpdated != null)
            {
                this.SkeletonUpdated(this,
                    new SkeletonUpdatedEventArgs() { HandRightJoint = skeleton.Joints[JointID.HandRight] });
            }
        }
开发者ID:kindohm,项目名称:kinect-level-up,代码行数:10,代码来源:KinectService.cs

示例10: kinectSensor_SkeletonFrameReady

        public void kinectSensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            Console.WriteLine("Hey, listen");
            SkeletonFrame skeletonFrame = e.SkeletonFrame;
            Boolean player1 = true;
            foreach (SkeletonData data in skeletonFrame.Skeletons)
            {
                if (data.TrackingState == SkeletonTrackingState.Tracked)
                    Console.WriteLine("Im watching you");
                {
                    if (player1)
                    {

                        foreach (Joint joint in data.Joints)
                        {
                            if (joint.ID == JointID.HandLeft)
                            {
                                player1LeftHand = joint.Position.ToVector2();
                            }
                            else if (joint.ID == JointID.ElbowLeft)
                            {
                                player1LeftElbow = joint.Position.ToVector2();
                            }
                        }

                        player1Theta = (float)Math.Atan(((player1LeftHand.Y - player1LeftElbow.Y) / (player1LeftHand.X - player1LeftElbow.X)));
                        player1Theta = (player1Theta * 180) / (float)Math.PI;
                        Console.WriteLine(player1Theta + "Is my angle");
                        thisGameIsAwesome.screenManager.input.myArmAngle = player1Theta;

                    }
                    else
                    {

                        foreach (Joint joint in data.Joints)
                        {
                            if (joint.ID == JointID.HandRight)
                            {
                                player2RightHand = joint.Position.ToVector2();
                            }
                            else if (joint.ID == JointID.ElbowRight)
                            {
                                player2RightElbow = joint.Position.ToVector2();
                            }
                        }

                        player2Theta = (float)Math.Atan(((player2RightHand.Y - player2RightElbow.Y) / (player2RightHand.X - player2RightElbow.X)));
                    }
                }
                //player1 = !player1;
                return;
            }
        }
开发者ID:ProjPossibility,项目名称:USC-AccessibleKinect,代码行数:53,代码来源:Mover.cs

示例11: kinectSensor_SkeletonFrameReady

 private void kinectSensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
 {
     foreach (SkeletonData s in e.SkeletonFrame.Skeletons)
     {
         if (s.TrackingState == SkeletonTrackingState.Tracked)
         {
             resolution = new Vector2(640, 480);
             skeleton = s;
             rightHandJoint = skeleton.Joints[JointID.HandRight];
             position = new Vector2((((0.5f * rightHandJoint.Position.X) + 0.5f) * (resolution.X)), (((-0.5f * rightHandJoint.Position.Y) + 0.5f) * (resolution.Y)));
         }
     }
 }
开发者ID:thefoofighter,项目名称:KinectTest,代码行数:13,代码来源:LoadKinect.cs

示例12: nui_SkeletonFrameReady

        /// <summary>
        /// the event handler for the skeleton frame ready event 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            SkeletonFrame allskeletons = e.SkeletonFrame;
            SkeletonData skeleton = (from s in allskeletons.Skeletons
                                     where s.TrackingState == SkeletonTrackingState.Tracked
                                     select s).FirstOrDefault();

            setpositionellipse(ellipse1,skeleton.Joints[JointID.Head]);
            setpositionellipse(ellipse2, skeleton.Joints[JointID.HandLeft]);
            setpositionellipse(ellipse3, skeleton.Joints[JointID.HandRight]);
            setpositionellipse(ellipse4, skeleton.Joints[JointID.FootLeft]);
            setpositionellipse(ellipse5, skeleton.Joints[JointID.FootRight]);

            getCoordinates_Playsound(skeleton.Joints[JointID.HandLeft]);
        }
开发者ID:hadyelsahar,项目名称:Kinect-Piano,代码行数:20,代码来源:MainWindow.xaml.cs

示例13: nui_SkeletonFrameReady

        void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            
            SkeletonFrame allSkeletons = e.SkeletonFrame;

            //get the first tracked skeleton
            SkeletonData skeleton = (from s in allSkeletons.Skeletons
                                     where s.TrackingState == SkeletonTrackingState.Tracked
                                     select s).FirstOrDefault();

            if(skeleton != null)
            {
                gestureController.processSkeletonFrame(skeleton);
            }
        }
开发者ID:guozanhua,项目名称:kinect-earth,代码行数:15,代码来源:MainWindow.xaml.cs

示例14: Nui_SkeletonFrameReady

        void Nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            canvas.Children.Clear();

            foreach (SkeletonData user in e.SkeletonFrame.Skeletons)
            {
                if (user.TrackingState == SkeletonTrackingState.Tracked)
                {
                    foreach (Joint joint in user.Joints)
                    {
                        DrawPoint(joint, Colors.Blue);
                    }
                }
            }
        }
开发者ID:hurns92,项目名称:kinectproject,代码行数:15,代码来源:MainWindow.xaml.cs

示例15: runtime_SkeletonFrameReady

        void runtime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            var skeleton =
                           e.SkeletonFrame.Skeletons
                           .Where(s => s.TrackingState == SkeletonTrackingState.Tracked)
                           .FirstOrDefault();

            if (skeleton == null)
            {
                return;
            }

            var position = skeleton.Joints[JointID.HandRight].Position;
            if (this.SkeletonUpdated != null)
            {
                this.SkeletonUpdated(this, new SkeletonEventArgs() { RightHandPosition = position });
            }
        }
开发者ID:kindohm,项目名称:kinect-mvvm,代码行数:18,代码来源:ConcreteKinectService.cs


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