Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8932399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:18:52+00:00 2026-06-15T09:18:52+00:00

I’ve been having some serious trouble getting skeleton tracking working properly for Kinect For

  • 0

I’ve been having some serious trouble getting skeleton tracking working properly for Kinect For Windows, using SDK v1.5 and VS2012. I’m building on the source code from https://github.com/EvilClosetMonkey/Fizbin.Kinect.Gestures , but the tracking goes completely astray when there’s multiple people on the screen. I’ve then gone on to look at the code here ( http://social.msdn.microsoft.com/Forums/en-US/kinectsdknuiapi/thread/459012d7-d51e-460d-aa6a-a1b80c27626c/ ), and I’ve attempted to integrate the “AppChoosesSkeletons” functionality (code below):

using System.Windows;
using System.Windows.Data;
using Microsoft.Kinect;
using Microsoft.Kinect.Toolkit;
using Microsoft.Samples.Kinect.WpfViewers;
using System.Diagnostics;
using System.ComponentModel;
using System.Linq;
using System;

namespace Fizbin.Kinect.Gestures.Demo
{
public partial class MainWindow : Window, INotifyPropertyChanged
{
    private readonly KinectSensorChooser sensorChooser = new KinectSensorChooser();

    private Skeleton[] skeletons = new Skeleton[0];

    // skeleton gesture recognizer
    private GestureController gestureController;

    public MainWindow()
    {
        DataContext = this;

        InitializeComponent();

        // initialize the Kinect sensor manager
        KinectSensorManager = new KinectSensorManager();
        KinectSensorManager.KinectSensorChanged += this.KinectSensorChanged;

        // locate an available sensor
        sensorChooser.Start();

        // bind chooser's sensor value to the local sensor manager
        var kinectSensorBinding = new Binding("Kinect") { Source = this.sensorChooser };
        BindingOperations.SetBinding(this.KinectSensorManager, KinectSensorManager.KinectSensorProperty, kinectSensorBinding);
    }

    #region Kinect Discovery & Setup

    private void KinectSensorChanged(object sender, KinectSensorManagerEventArgs<KinectSensor> args)
    {
        if (null != args.OldValue)
            UninitializeKinectServices(args.OldValue);

        if (null != args.NewValue)
            InitializeKinectServices(KinectSensorManager, args.NewValue);
    }

    /// <summary>
    /// Kinect enabled apps should customize which Kinect services it initializes here.
    /// </summary>
    /// <param name="kinectSensorManager"></param>
    /// <param name="sensor"></param>
    private void InitializeKinectServices(KinectSensorManager kinectSensorManager, KinectSensor sensor)
    {
        // Application should enable all streams first.

        // configure the color stream
        kinectSensorManager.ColorFormat = ColorImageFormat.RgbResolution640x480Fps30;
        kinectSensorManager.ColorStreamEnabled = true;

        // configure the depth stream
        kinectSensorManager.DepthStreamEnabled = true;

        kinectSensorManager.TransformSmoothParameters =
            new TransformSmoothParameters
            {
                Smoothing = 0.5f,
                Correction = 0.5f,
                Prediction = 0.5f,
                JitterRadius = 0.05f,
                MaxDeviationRadius = 0.04f
            };

        // configure the skeleton stream
        sensor.SkeletonFrameReady += FramesReady;
        kinectSensorManager.SkeletonStreamEnabled = true;
        sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
        // initialize the gesture recognizer
        gestureController = new GestureController();
        gestureController.GestureRecognized += OnGestureRecognized;

        kinectSensorManager.KinectSensorEnabled = true;

        if (!kinectSensorManager.KinectSensorAppConflict)
        {
            // addition configuration, as needed
        }
    }

    /// <summary>
    /// Kinect enabled apps should uninitialize all Kinect services that were initialized in InitializeKinectServices() here.
    /// </summary>
    /// <param name="sensor"></param>
    private void UninitializeKinectServices(KinectSensor sensor)
    {

    }

    #endregion Kinect Discovery & Setup

    #region Properties

    public static readonly DependencyProperty KinectSensorManagerProperty =
        DependencyProperty.Register(
            "KinectSensorManager",
            typeof(KinectSensorManager),
            typeof(MainWindow),
            new PropertyMetadata(null));

    public KinectSensorManager KinectSensorManager
    {
        get { return (KinectSensorManager)GetValue(KinectSensorManagerProperty); }
        set { SetValue(KinectSensorManagerProperty, value); }
    }

    /// <summary>
    /// Gets or sets the last recognized gesture.
    /// </summary>
    private string _gesture;
    public String Gesture
    {
        get { return _gesture; }

        private set
        {
            if (_gesture == value)
                return;

            _gesture = value;

            Debug.WriteLine("Gesture = " + _gesture);

            if (this.PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs("Gesture"));
        }
    }

    #endregion Properties

    #region Events

    /// <summary>
    /// Event implementing INotifyPropertyChanged interface.
    /// </summary>
    public event PropertyChangedEventHandler PropertyChanged;

    #endregion Events

    #region Event Handlers

    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e">Gesture event arguments.</param>
    private void OnGestureRecognized(object sender, GestureEventArgs e)
    {
        Debug.WriteLine(e.GestureType);

        switch (e.GestureType)
        {
            case GestureType.Menu:
                Gesture = "Menu";
                break;
            case GestureType.WaveRight:
                Gesture = "Wave Right";
                break;
            case GestureType.WaveLeft:
                Gesture = "Wave Left";
                break;
            case GestureType.JoinedHands:
                Gesture = "Joined Hands";
                break;
            case GestureType.SwipeLeft:
                Gesture = "Swipe Left";
                break;
            case GestureType.SwipeRight:
                Gesture = "Swipe Right";
                break;
            case GestureType.ZoomIn:
                Gesture = "Zoom In";
                break;
            case GestureType.ZoomOut:
                Gesture = "Zoom Out";
                break;

            default:
                break;
        }
    }

    void FramesReady(object sender, AllFramesReadyEventArgs e, KinectSensor sensor)
    {
        Skeleton skeleton = FindSkeleton(e);
        if (skeleton != null)
        {
            gestureController.UpdateAllGestures(skeleton);
        }
    }

    private int CurrentTrackingId = 0;

    Skeleton FindSkeleton(AllFramesReadyEventArgs e)
    {
        Skeleton skeleton = null;

        using (SkeletonFrame SFrame = e.OpenSkeletonFrame())
        {
            if (SFrame == null)
            {
                return null;
            }

            if (skeletons == null)
            {
                skeletons = new Skeleton[SFrame.SkeletonArrayLength];
            }

            SFrame.CopySkeletonDataTo(skeletons);

            if (CurrentTrackingId != 0)
            {
                // We've been tracking someone; see if they're still here

                skeleton =
                    (from s in skeletons
                     where s.TrackingState == SkeletonTrackingState.Tracked &&
                           s.Joints[JointType.Head].TrackingState == JointTrackingState.Tracked &&
                           s.TrackingId == CurrentTrackingId
                     select s).FirstOrDefault();

                if (skeleton == null)
                {
                    CurrentTrackingId = 0;
                    sensor.SkeletonStream.AppChoosesSkeletons = false;
                }
            }
            else
            {
                // Try to find someone new

                skeleton =
                    (from s in skeletons
                     where s.TrackingState == SkeletonTrackingState.Tracked &&
                           s.Joints[JointType.Head].TrackingState == JointTrackingState.Tracked
                     select s).FirstOrDefault();

                if (skeleton != null)
                {
                    CurrentTrackingId = skeleton.TrackingId;
                    sensor.SkeletonStream.AppChoosesSkeletons = true;
                    sensor.SkeletonStream.ChooseSkeletons(CurrentTrackingId);
                }
            }
        }

        return skeleton;
    }

    #endregion Event Handlers

   }
}

However, I’m getting errors from VS2012 about:

1) No overload for ‘FramesReady’ matches delegate ‘System.EventHandler’

2) ‘sensor’ not existing (most likely due to it not being imported, but from what I’ve tried, passing the sensor across methods causes more errors)

If anyone can help with this, or even point me in the right direction towards solving this, that would be great! To reiterate, the main goal is to have the Kinect lock onto the first person it finds, and maintain that lock with multiple people moving around in the line of sight.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:18:53+00:00Added an answer on June 15, 2026 at 9:18 am

    If you are planning you continue to use the KinectSensorManager you can use the KinectSkeletonChooser to help you pick out the skeleton you want. This helper function is also included in the KinectWpfViewers project. You will not need to add any additional code to the code behind in order to use it.

    Easiest way to get it going is to just add it to your XAML. Updating the demo code that comes with the Except on Tuesdays’ library, it would look like th:

    <Window x:Class="Fizbin.Kinect.Gestures.Demo.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:kv="clr-namespace:Microsoft.Samples.Kinect.WpfViewers;assembly=Microsoft.Samples.Kinect.WpfViewers"
            Title="MainWindow" Height="350" Width="525">
        <Grid>        
            <Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="320" Height="240">
                <kv:KinectSkeletonChooser KinectSensorManager="{Binding KinectSensorManager}" SkeletonChooserMode="Sticky1Player" />
                <kv:KinectDepthViewer x:Name="DepthViewer" KinectSensorManager="{Binding KinectSensorManager}" />
                <Canvas>
                    <kv:KinectSkeletonViewer
                                        KinectSensorManager="{Binding KinectSensorManager}"
                                        Width="{Binding ElementName=DepthViewer, Path=ActualWidth}"
                                        Height="{Binding ElementName=DepthViewer, Path=ActualHeight}"
                                        ShowBones="True" ShowJoints="True" ShowCenter="True" ImageType="Depth" />
                </Canvas>
            </Grid>
    
            <TextBlock Text="{Binding Gesture}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" FontWeight="Bold" Margin="-2,0,0,0"/>
            <TextBlock Text="{Binding Gesture}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" FontWeight="Bold" Margin="2,0,0,0"/>
            <TextBlock Text="{Binding Gesture}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" FontWeight="Bold" Margin="0,-2,0,0"/>
            <TextBlock Text="{Binding Gesture}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" FontWeight="Bold" Margin="0,2,0,0"/>
            <TextBlock Text="{Binding Gesture}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="48" FontWeight="Bold" Foreground="White"/>
    
        </Grid>
    </Window>
    

    Note the new KinectSkeletonChooser tag on line 8.

    Other options available can be see in the SkeletonChooserMode enum:

    public enum SkeletonChooserMode
    {
        /// <summary>
        /// Use system default tracking
        /// </summary>
        DefaultSystemTracking,
    
        /// <summary>
        /// Track the player nearest to the sensor
        /// </summary>
        Closest1Player,
    
        /// <summary>
        /// Track the two players nearest to the sensor
        /// </summary>
        Closest2Player,
    
        /// <summary>
        /// Track one player based on id
        /// </summary>
        Sticky1Player,
    
        /// <summary>
        /// Track two players based on id
        /// </summary>
        Sticky2Player,
    
        /// <summary>
        /// Track one player based on most activity
        /// </summary>
        MostActive1Player,
    
        /// <summary>
        /// Track two players based on most activity
        /// </summary>
        MostActive2Player
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.