Created
December 11, 2011 05:20
-
-
Save Aesir/1458553 to your computer and use it in GitHub Desktop.
Example of SkeletonTracking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gist related to this commit of ObservableKinect: Aesir/ObservableKinect@3dd1b11