none
Extract Kinect skeleton coordinates values

    질문

  • Hello

    I would like to know how to extract the values ​​of the
    skeleton coordinates in vpl


    example: hand left - (coord x)



    • 편집됨 konnect rob 2012년 1월 27일 금요일 오후 8:28
    2012년 1월 27일 금요일 오후 8:11

답변

  • Use the "UpdateControl" message from the Calculate activity.

    If you want to get continuous updates from the Kinect you can use a timer like this.
    I set the timer to 250ms initially and then reset it to 250ms after the dialog update is successful.

    Once the Kinect has recognized a skeleton, the dialog will update the assigned field with the new data every 250 ms

    2012년 3월 27일 화요일 오전 12:34
    소유자

모든 응답

  • i'd like to know that too... any help would be greatly appreciated :)
    2012년 2월 3일 금요일 오후 9:11
    1. You must be using the final release of RDS4 and final release of Kinect for Windows 1.0
    2. Instead of looking at the "Notifications" you must instead perform a "QueryRawFrame" and respond to the "Success" message
    3. The data you seek is in the RawFrames object...

    RawFrames.RawSkeletonFrameData.SkeletonData[0].Joints[JointType.HandLeft].Position.X

    2012년 3월 15일 목요일 오전 12:32
    소유자
  • Great - After this, is it possible to display the extracted values ​​of the skeleton coordinates in vpl in a Dialog or something so that I can see it? I hope that my questions is clear.

    Like this...  

    2012년 3월 22일 목요일 오전 5:11
  • Use the "UpdateControl" message from the Calculate activity.

    If you want to get continuous updates from the Kinect you can use a timer like this.
    I set the timer to 250ms initially and then reset it to 250ms after the dialog update is successful.

    Once the Kinect has recognized a skeleton, the dialog will update the assigned field with the new data every 250 ms

    2012년 3월 27일 화요일 오전 12:34
    소유자
  • I'm having some issues getting this example to work properly in VPL. What are your data connection parameters for the Kinect box and the Flexible Dialog box? Thanks!
    2012년 4월 10일 화요일 오전 4:52
  • I'm still unable to get this VPL code outlined above to function. Can you provide a sample file?
    2012년 4월 20일 금요일 오전 3:41
  • please find the code in which we can get the co ordinates of each joint . I would like to know how to save the co-ordinates value in file . You will find the depth , skeleton , and skeleton with ellipses . you will also find the X Y Z coordinates in out . Please note I am still trying to confiugre so please bear wtih the output.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Microsoft.Kinect;
    using Coding4Fun.Kinect.Wpf;
    using System.Diagnostics;


    namespace Play_v_6
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }

            private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                kinectSensorChooser1.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged);
            }

            void kinectSensorChooser1_KinectSensorChanged(object sender, DependencyPropertyChangedEventArgs e)
            {
                KinectSensor oldsensor = (KinectSensor)e.OldValue;

                StopKinect(oldsensor);

                KinectSensor newsensor = (KinectSensor)e.NewValue;

                newsensor.DepthStream.Enable();
                newsensor.SkeletonStream.Enable();

                
                newsensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(newsensor_SkeletonFrameReady);
                //newsensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(newsensor_AllFramesReady);
                newsensor.Start();
                //throw new NotImplementedException();
            }

           



            public void SetEllipsePosition(Ellipse ellipse, Joint joint)
            {
                Canvas.SetLeft(ellipse, (320 * joint.Position.X) + 320);
                Canvas.SetTop(ellipse, (240 * -joint.Position.Y) + 240);
            }



            Skeleton[] skeletons = null;

            void newsensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
            {

                 using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
                 {              
                     if (skeletonFrame != null)
                    {
                        if (this.skeletons == null)
                        {
                            this.skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                        }   
                        skeletonFrame.CopySkeletonDataTo(this.skeletons);
                        Skeleton skeleton = this.skeletons.Where(s => s.TrackingState == SkeletonTrackingState.Tracked).FirstOrDefault();




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

                        }*/



                        if (skeleton != null)
                        {
                            
                            SetEllipsePosition(HipCenter, skeleton.Joints[JointType.HipCenter]);
                            SetEllipsePosition(Spine, skeleton.Joints[JointType.Spine]);
                            SetEllipsePosition(ShoulderCenter, skeleton.Joints[JointType.ShoulderCenter]);
                            SetEllipsePosition(Head, skeleton.Joints[JointType.Head]);
                            SetEllipsePosition(ShoulderLeft, skeleton.Joints[JointType.ShoulderLeft]);
                            SetEllipsePosition(ElbowLeft, skeleton.Joints[JointType.ElbowLeft]);
                            SetEllipsePosition(WristLeft, skeleton.Joints[JointType.WristLeft]);
                            SetEllipsePosition(HandLeft, skeleton.Joints[JointType.HandLeft]);
                            SetEllipsePosition(ShoulderRight, skeleton.Joints[JointType.ShoulderRight]);
                            SetEllipsePosition(ElbowRight, skeleton.Joints[JointType.ElbowRight]);
                            SetEllipsePosition(WristRight, skeleton.Joints[JointType.WristRight]);
                            SetEllipsePosition(HandRight, skeleton.Joints[JointType.HandRight]);
                            SetEllipsePosition(HipLeft, skeleton.Joints[JointType.HipLeft]);
                            SetEllipsePosition(KneeLeft, skeleton.Joints[JointType.KneeLeft]);
                            SetEllipsePosition(AnkleLeft, skeleton.Joints[JointType.AnkleLeft]);
                            SetEllipsePosition(FootLeft, skeleton.Joints[JointType.FootLeft]);
                            SetEllipsePosition(HipRight, skeleton.Joints[JointType.HipRight]);
                            SetEllipsePosition(KneeRight, skeleton.Joints[JointType.KneeRight]);
                            SetEllipsePosition(AnkleRight, skeleton.Joints[JointType.AnkleRight]);
                            SetEllipsePosition(FootRight, skeleton.Joints[JointType.FootRight]);

                  
                        }

                        
                        
                          
                        if(skeleton !=null)

                        {
                            Joint j = skeleton.Joints[JointType.Head];

                        
                        if (j.TrackingState == JointTrackingState.Tracked)
                            {
                                Console.WriteLine("The output of X Y Z coordinates");
                             Debug.WriteLine("Head: X AXIS" + j.Position.X + ",Y AXIS \t " + j.Position.Y + ",Z AXIS\t " + j.Position.Z);
                            }
                        }
                        if (skeleton != null)
                        {
                            Joint j = skeleton.Joints[JointType.KneeLeft];

                            if (j.TrackingState == JointTrackingState.Tracked)
                            {
                                Console.WriteLine("The output of X Y Z coordinates");

                                Console.WriteLine("Head: X AXIS" + j.Position.X + ",Y AXIS \t " + j.Position.Y + ",Z AXIS\t " + j.Position.Z);
                            }
                        }


                         }

                }
            }

            

            private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
            {
                StopKinect(kinectSensorChooser1.Kinect);
            }

            void StopKinect(KinectSensor sensor)
            {
                if (sensor != null)
                {
                    sensor.Stop();
                }

            }

        }
    }

    XML code

    <Window x:Class="Play_v_6.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="923" Loaded="Window_Loaded" Closing="Window_Closing" xmlns:my="clr-namespace:Microsoft.Samples.Kinect.WpfViewers;assembly=Microsoft.Samples.Kinect.WpfViewers">
        <Grid>
            <Canvas>
                <my:KinectDepthViewer HorizontalAlignment="Left" Margin="12,12,0,0" Name="kinectDepthViewer1" VerticalAlignment="Top" Height="218" Width="384" Kinect="{Binding ElementName=kinectSensorChooser1, Path=Kinect}" />
            <my:KinectSensorChooser HorizontalAlignment="Left" Margin="326,179,0,0" Name="kinectSensorChooser1" VerticalAlignment="Top" Width="328" />
            <my:KinectSkeletonViewer HorizontalAlignment="Left" Margin="499,12,0,0" Name="kinectSkeletonViewer1" VerticalAlignment="Top" Height="229" Width="373" Kinect="{Binding ElementName=kinectSensorChooser1, Path=Kinect}" />

                <Ellipse Height="10" Width="10" Fill="Blue" Name="HipCenter"/>
                
                <Ellipse Height="10" Width="10" Fill="Blue" Name="Spine"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="ShoulderCenter"/>
                <Ellipse Height="25" Width="15" Fill="yellow" Name="Head" Canvas.Left="113" Canvas.Top="12" />
                <Ellipse Height="10" Width="10" Fill="Blue" Name="ShoulderLeft"/>
                <Ellipse Height="10" Width="10" Fill="Magenta" Name="ElbowLeft"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="WristLeft"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="HandLeft"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="ShoulderRight"/>
                <Ellipse Height="10" Width="10" Fill="Magenta" Name="ElbowRight"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="WristRight"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="HandRight"/>
                <Ellipse Height="10" Width="10" Fill="Blue" Name="HipLeft"/>
                <Ellipse Height="15" Width="10" Fill="Red" Name="KneeLeft" Canvas.Left="28" Canvas.Top="86" />
                <Ellipse Height="10" Width="10" Fill="Blue" Name="AnkleLeft" Canvas.Left="70" Canvas.Top="42" />
                <Ellipse Height="10" Width="10" Fill="Blue" Name="FootLeft" Canvas.Left="12" Canvas.Top="99" />
                <Ellipse Height="10" Width="10" Fill="Blue" Name="HipRight" Canvas.Left="118" Canvas.Top="74" />
                <Ellipse Height="15" Width="10" Fill="Red" Name="KneeRight" Canvas.Left="246" Canvas.Top="20" />
                <Ellipse Height="10" Width="10" Fill="Blue" Name="AnkleRight" Canvas.Left="416" Canvas.Top="12" />
                <Ellipse Height="10" Width="10" Fill="Blue" Name="FootRight" Canvas.Left="454" Canvas.Top="12" />
            </Canvas>


        </Grid>
    </Window>


    • 편집됨 KhanAfzal 2013년 9월 26일 목요일 오후 9:44 to get notification when someone responds to this post
    2013년 9월 26일 목요일 오후 9:34