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


C# Kinect.SkeletonFrameReadyEventArgs类代码示例

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


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

示例1: Nui_SkeletonFrameReady

        static void Nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            if (!_initialized) return;

            List<Skeleton> users = new List<Skeleton>();

            SkeletonFrame skeletonFrame = e.OpenSkeletonFrame();
            Skeleton[] skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];

            skeletonFrame.CopySkeletonDataTo(skeletons);

            foreach (var user in skeletons)
            {
                if (user.TrackingState == SkeletonTrackingState.Tracked)
                {
                    users.Add(user);
                }
            }

            if (users.Count > 0)
            {
                string json = users.Serialize();

                foreach (var socket in _sockets)
                {
                    socket.Send(json);
                }
            }
        }
开发者ID:uniphil,项目名称:FitHub,代码行数:29,代码来源:Program.cs

示例2: Kinect_SkeletonFrameReadyTwo

        //Eventhanterare för andra skeletet
        public void Kinect_SkeletonFrameReadyTwo(object sender, SkeletonFrameReadyEventArgs e)
        {
            SkeletonsPanelTwo.Children.Clear();

            if (this.IsEnabled)
            {
                using (SkeletonFrame frame = e.OpenSkeletonFrame())
                {
                    if (frame != null)
                    {
                        if (this.IsEnabled)
                        {
                            frame.CopySkeletonDataTo(this._FrameSkeletons);

                            for (int i = 0; i < this._FrameSkeletons.Length; i++)
                            {
                                DrawSkeleton(this._FrameSkeletons[i], this._SkeletonBrushes[i]);

                                TrackJoint(this._FrameSkeletons[i].Joints[JointType.HandLeft], this._SkeletonBrushes[i]);
                                TrackJoint(this._FrameSkeletons[i].Joints[JointType.HandRight], this._SkeletonBrushes[i]);
                                TrackJoint(this._FrameSkeletons[i].Joints[JointType.HipLeft], this._SkeletonBrushes[i]);
                                TrackJoint(this._FrameSkeletons[i].Joints[JointType.HipRight], this._SkeletonBrushes[i]);
                                TrackJoint(this._FrameSkeletons[i].Joints[JointType.KneeLeft], this._SkeletonBrushes[i]);
                                TrackJoint(this._FrameSkeletons[i].Joints[JointType.KneeRight], this._SkeletonBrushes[i]);
                            }

                        }
                    }
                }
            }
        }
开发者ID:kulturberikare,项目名称:RUNKinect,代码行数:32,代码来源:SkeletonViewerTwo.xaml.cs

示例3: SensorSkeletonFrameReady

        private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs skeletonFrameReadyEventArgs)
        {
            
            using (SkeletonFrame skeletonFrame = skeletonFrameReadyEventArgs.OpenSkeletonFrame())
            {
                if (skeletonFrame == null)
                    return;

                
                try
                {
                    

                    skeletonFrame.CopySkeletonDataTo(skeletons);
                    var accelerometerReading = sensor.AccelerometerGetCurrentReading();
                    interactionStream.ProcessSkeleton(skeletons, accelerometerReading, skeletonFrame.Timestamp);

                   
                }
                catch (InvalidOperationException)
                {
                    // SkeletonFrame functions may throw when the sensor gets
                    // into a bad state.  Ignore the frame in that case.
                }
            }
        }
开发者ID:GregWard,项目名称:Tronsformers,代码行数:26,代码来源:KinectEvents.cs

示例4: KinectOnSkeletonFrameReady

        private static void KinectOnSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs skeletonFrameReadyEventArgs)
        {
            using (var frame = skeletonFrameReadyEventArgs.OpenSkeletonFrame())
            {
                if (frame == null) return;

                //フレームに含まれる骨格情報を取得する
                var skeletonData = new Skeleton[frame.SkeletonArrayLength];
                frame.CopySkeletonDataTo(skeletonData);

                foreach (var skeleton in skeletonData)
                {
                    if (skeleton == null) continue;

                    //トラッキングできている骨格だけ取得
                    if (skeleton.TrackingState != SkeletonTrackingState.Tracked) continue;
                    foreach (Joint joint in skeleton.Joints)
                    {
                        //トラッキングできている関節だけ取得
                        if (joint.TrackingState != JointTrackingState.Tracked) continue;
                        Console.WriteLine("JointType: {0}\t X: {1} \t Y: {2} \t Z: {3}", joint.JointType, joint.Position.X, joint.Position.Y, joint.Position.Z);

                        //座標系の変換
                        var cp = (sender as KinectSensor).CoordinateMapper.MapSkeletonPointToColorPoint(joint.Position, ColorImageFormat.RawBayerResolution640x480Fps30);
                        Console.WriteLine("RGB X: {0} \t RGB Y: {1}", cp.X, cp.Y);
                    }
                }
            }
        }
开发者ID:buchizo,项目名称:ITAP5,代码行数:29,代码来源:Program.cs

示例5: Sensor_SkeletonFrameReady

		void Sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
		{
			using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
			{
				skeletonFrame.CopySkeletonDataTo(this.FSkeletons);
			}
		}
开发者ID:kevinbs,项目名称:VVVV.Packs.Image,代码行数:7,代码来源:Skeleton.cs

示例6: myKinect_AllFramesReady

        private void myKinect_AllFramesReady(Object sender,SkeletonFrameReadyEventArgs e)
        {
            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    if (this.skeletonData == null || (this.skeletonData.Length != skeletonFrame.SkeletonArrayLength))
                    {
                        this.skeletonData = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    }

                    skeletonFrame.CopySkeletonDataTo(skeletonData);

                    foreach(Skeleton skeleton in skeletonData)
                    {
                        if(skeleton.TrackingState == SkeletonTrackingState.Tracked)
                        {
                            double x = 0, y = 0, z = 0;
                            Joint joint = skeleton.Joints[JointType.HandRight];
                            x = joint.Position.X;
                            y = joint.Position.Y;
                            z = joint.Position.Z;
                            tRightHand.Content = "X: " + x + " \nY: " + y + " \nZ: " + z;
                            if (x > 0.5)
                            {
                                tRightHand.Foreground = Brushes.Red;
                            } else
                            {
                                tRightHand.Foreground = Brushes.Black;
                            }
                        }
                    }
                }
            }
        }
开发者ID:Broams,项目名称:holography,代码行数:35,代码来源:MainWindow.xaml.cs

示例7: sensor_SkeletonFrameReady

        void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            //frameNumber = frameNumber + 1;
            timepassed++;
            seconds = timepassed / 30;

            e.OpenSkeletonFrame().CopySkeletonDataTo(skeletons);
            int counter = 0;
            foreach(Skeleton skeleton in skeletons)
            {
                if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
                    counter++;
            }

            //Console.WriteLine("Frame: {0}, Number of Skeletons: {1}",  frameNumber, counter);
            if (timepassed == seconds * 30)
                Console.WriteLine("Seconds passed: {0}, Number of Skeletons: {1}", seconds, counter);

            if (counter > 0)
            {
                if (timepassed == seconds * 30)
                {
                    Console.WriteLine("Location of head: " + skeletons[counter].Joints[JointType.Head].Position.X + ", " + skeletons[counter].Joints[JointType.Head].Position.Y + ", " + skeletons[counter].Joints[JointType.Head].Position.Z + "; Found at: " + DateTime.Now);
                }
            }
        }
开发者ID:hcilab-um,项目名称:STim,代码行数:26,代码来源:Program.cs

示例8: NewSensor_SkeletonFrameReady

        void NewSensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs args)
        {
            var colors = new Dictionary<int, Color>();
            Skeleton[] skeletons;

            using (var frame = args.OpenSkeletonFrame())
            {
                if (frame == null)
                    return;

                skeletons = new Skeleton[frame.SkeletonArrayLength];
                frame.CopySkeletonDataTo(skeletons);
            }

            foreach (var skeleton in skeletons.Where(s => SkeletonTrackingState.Tracked.Equals(s.TrackingState)))
            {
                Random _rnd = new Random();
                var userId = skeleton.TrackingId;

                var crazyColors = Color.FromRgb((byte)_rnd.Next(255), (byte)_rnd.Next(255), (byte)_rnd.Next(255));

                colors.Add(userId, KinectRegion.PrimaryUserTrackingId == userId ?
                    crazyColors :
                    Colors.Blue);
            }

            this.KinectUserViewer.UserColors = colors;
        }
开发者ID:jorgeLuizChaves,项目名称:K4W,代码行数:28,代码来源:KinectInteractionsConfig.cs

示例9: kinectSensor_SkeletonFrameReady

        private void kinectSensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (SkeletonFrame frame = e.OpenSkeletonFrame())
            {
                if (frame == null)
                    return;

                frame.GetSkeletons(ref skeletons);

                if (skeletons.All(s => s.TrackingState == SkeletonTrackingState.NotTracked))
                    return;

                foreach (var skeleton in skeletons)
                {
                    if (skeleton.TrackingState != SkeletonTrackingState.Tracked)
                        continue;

                    foreach (Joint joint in skeleton.Joints)
                    {
                        if (joint.TrackingState != JointTrackingState.Tracked)
                            continue;

                        if (joint.JointType == JointType.HandRight)
                        {
                            MouseController.Current.SetHandPosition(kinectSensor, joint, skeleton);
                        }
                    }
                }
            }
        }
开发者ID:rajankz,项目名称:cmsc838f-a4,代码行数:30,代码来源:MainWindow.xaml.cs

示例10: Sensor_SkeletonFrameReady

        void Sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (var frame = e.OpenSkeletonFrame())
            {
                if (frame != null)
                {
                    canvas.ClearSkeletons();

                    var skeletons = frame.Skeletons().Where(s => s.TrackingState == SkeletonTrackingState.Tracked);

                    foreach (var skeleton in skeletons)
                    {
                        if (skeleton != null)
                        {
                            // Update skeleton gestures.
                            _gestureController.Update(skeleton);

                            // Draw skeleton.
                            canvas.DrawSkeleton(skeleton);

                        }
                    }
                }
            }
        }
开发者ID:Milpoder,项目名称:NPI,代码行数:25,代码来源:MainWindow.xaml.cs

示例11: kinect_SkeletonFrameReady

        /// <summary>
        /// スケルトンの更新通知
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void kinect_SkeletonFrameReady( object sender, SkeletonFrameReadyEventArgs e )
        {
            try {
            // Kinectのインスタンスを取得する
            KinectSensor kinect = sender as KinectSensor;
            if ( kinect == null ) {
              return;
            }

            // スケルトンのフレームを取得する
            using ( SkeletonFrame skeletonFrame = e.OpenSkeletonFrame() ) {
              if ( skeletonFrame != null ) {
            Skeleton skeleton = skeletonFrame.GetFirstTrackedSkeleton();
            if ( skeleton != null ) {
              // ポーズの検出用に、スケルトンデータを追加する
              postureDetector.TrackPostures( skeleton );

              // 右手がトラッキングされていた場合、ジェスチャーの検出用にジョイントを追加する
              Joint hand = skeleton.Joints[JointType.HandRight];
              if ( hand.TrackingState == JointTrackingState.Tracked ) {
                swipeDetector.Add( hand.Position, kinect );

              }
            }
              }
            }
              }
              catch ( Exception ex ) {
            MessageBox.Show( ex.Message );
              }
        }
开发者ID:hatsunea,项目名称:KinectSDKBook4CS,代码行数:36,代码来源:MainWindow.xaml.cs

示例12: Sensor_SkeletonFrameReady

        void Sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (var frame = e.OpenSkeletonFrame())
            {
                if (frame != null)
                {
                    canvas.ClearSkeletons();
                    tblHeights.Text = string.Empty;

                    var skeletons = frame.Skeletons().Where(s => s.TrackingState == SkeletonTrackingState.Tracked);

                    foreach (var skeleton in skeletons)
                    {
                        if (skeleton != null)
                        {
                            // Update skeleton gestures.
                            _gestureController.Update(skeleton);

                            // Draw skeleton.
                            canvas.DrawSkeleton(skeleton);

                            // Display user height.
                            tblHeights.Text += string.Format("\nUser {0}: {1}cm", skeleton.TrackingId, skeleton.Height());
                        }
                    }
                }
            }
        }
开发者ID:etrigger,项目名称:Vitruvius,代码行数:28,代码来源:MainWindow.xaml.cs

示例13: miKinect_SkeletonFrameReady

        private void miKinect_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            canvasesqueleto.Children.Clear();
            Skeleton[] esqueletos = null;

            using (SkeletonFrame frameEsqueleto = e.OpenSkeletonFrame()) {
                if (frameEsqueleto != null) {
                    esqueletos = new Skeleton[frameEsqueleto.SkeletonArrayLength];
                    frameEsqueleto.CopySkeletonDataTo(esqueletos);
                }
            }

            if (esqueletos == null) return;

            foreach (Skeleton esqueleto in esqueletos) {
                if (esqueleto.TrackingState == SkeletonTrackingState.Tracked) { 
                    Joint handJoint = esqueleto.Joints[JointType.HandRight];
                    Joint elbowJoint = esqueleto.Joints[JointType.ElbowRight];

                    Line huesoBrazoDer = new Line();
                    huesoBrazoDer.Stroke = new SolidColorBrush(Colors.Red);
                    huesoBrazoDer.StrokeThickness = 5;

                    ColorImagePoint puntoMano = miKinect.CoordinateMapper.MapSkeletonPointToColorPoint(handJoint.Position, ColorImageFormat.RgbResolution640x480Fps30);
                    huesoBrazoDer.X1 = puntoMano.X;
                    huesoBrazoDer.Y1 = puntoMano.Y;

                    ColorImagePoint puntoCodo = miKinect.CoordinateMapper.MapSkeletonPointToColorPoint(elbowJoint.Position, ColorImageFormat.RgbResolution640x480Fps30);
                    huesoBrazoDer.X2 = puntoCodo.X;
                    huesoBrazoDer.Y2 = puntoCodo.Y;

                    canvasesqueleto.Children.Add(huesoBrazoDer);
                }
            }
        }
开发者ID:egaleano,项目名称:Kinect,代码行数:35,代码来源:MainWindow.xaml.cs

示例14: kinect_SkeletonFrameReady

        private void kinect_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            //Debug.WriteLine("In kinect skeleton event handler");

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) // Open the Skeleton frame
            {
                if (skeletonFrame != null && this.skeletonData != null) // check that a frame is available
                {
                    skeletonFrame.CopySkeletonDataTo(this.skeletonData); // get the skeletal information in this frame
                }
            }
               // Debug.WriteLine(this.skeletonData.Length);

            foreach (Skeleton skel in this.skeletonData)
            {
                if (skel.TrackingState == SkeletonTrackingState.Tracked)
                {
                    count++;
                    if (count > 50)
                    {
                        Console.WriteLine("id: " + skel.TrackingId + "shoulder L      X:" + skel.Joints[JointType.ShoulderLeft].Position.X + " Y: " + skel.Joints[JointType.ShoulderLeft].Position.Y + " Z: " + skel.Joints[JointType.ShoulderLeft].Position.Z);
                        Console.WriteLine("id: " + skel.TrackingId + "shoulder C      X:" + skel.Joints[JointType.ShoulderCenter].Position.X + " Y: " + skel.Joints[JointType.ShoulderCenter].Position.Y + " Z: " + skel.Joints[JointType.ShoulderCenter].Position.Z);
                        Console.WriteLine("id: " + skel.TrackingId + "shoulder R      X:" + skel.Joints[JointType.ShoulderRight].Position.X + " Y: " + skel.Joints[JointType.ShoulderRight].Position.Y + " Z: " + skel.Joints[JointType.ShoulderRight].Position.Z);
                        //Console.WriteLine("id: " + skel.TrackingId + " X: " + skel.Position.X + " Y: " + skel.Position.Y + " Z: " + skel.Position.Z);
                        count = 0;
                    }
                }

            }
        }
开发者ID:seapong,项目名称:capstone,代码行数:30,代码来源:Program.cs

示例15: Sensor_SkeletonFrameReady

        void Sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (var frame = e.OpenSkeletonFrame())
            {
                if (frame != null)
                {
                    canvas.Children.Clear();

                    Skeleton[] skeletons = new Skeleton[frame.SkeletonArrayLength];

                    frame.CopySkeletonDataTo(skeletons);

                    var skeleton = skeletons.Where(s => s.TrackingState == SkeletonTrackingState.Tracked).FirstOrDefault();

                    if (skeleton != null)
                    {
                        // Calculate height.
                        double height = Math.Round(skeleton.Height(), 2);

                        // Draw skeleton joints.
                        foreach (JointType joint in Enum.GetValues(typeof(JointType)))
                        {
                            //DrawJoint(skeleton.Joints[joint].ScaleTo(640, 480));
                            Point p = posionScale(skeleton.Joints[joint].Position);
                            DrawJoint(p);
                        }

                        // Display height.
                        tblHeight.Text = "Height: " + height.ToString() + "m";
                    }
                }
            }
        }
开发者ID:RyanAuu,项目名称:yyf,代码行数:33,代码来源:MainWindow.xaml.cs


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