Skip to content

Instantly share code, notes, and snippets.

@Aesir
Created December 11, 2011 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aesir/1458553 to your computer and use it in GitHub Desktop.
Save Aesir/1458553 to your computer and use it in GitHub Desktop.
Example of SkeletonTracking
var st = new SkeletonTracking();
//If you want to know if a skeleton is currently being tracked by the Kinect
//SkeletonPresent produces a "True" value every time the Kinect changes from
//not tracking anyone and a "False" if there is no longer anyone to track
st.SkeletonPresent.Subscribe(
p =>
{
if (p)
Console.ForegroundColor = ConsoleColor.Green;
else
Console.ForegroundColor = ConsoleColor.Red;
});
//If you want to track individual skeletons FreshSkeletons produces a
//value every time there is at least one new skeleton to track and each
//skeleton gets its own IObservable stream which will complete when that
//skeleton is no longer being tracked.
st.FreshSkeletons.Subscribe(
skels =>
{
Console.WriteLine("{0} fresh skeletons produced", skels.Count());
foreach (var skel in skels)
{
skel.Subscribe(
s => Console.WriteLine("Skeleton with Id {0} produced a value.", s.TrackingID),
() => Console.WriteLine("Skeleton is no longer being tracked.")
);
}
});
@Aesir
Copy link
Author

Aesir commented Dec 11, 2011

Gist related to this commit of ObservableKinect: Aesir/ObservableKinect@3dd1b11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment