I was hoping someone could help point me in the right direction.
I’m looking for a way to use the Microsoft Kinect to turn off a lamp. The lamp is connected to a Home Easy remote socket switch which is paired with a Telldus Tellstick.
I am using C# to write the application, now I have a vague idea in my head what I would like to do, and after using the Kinect SDK I have a better understanding of how to use the Kinect.
What I would like to know is what would be the most logical way to create this application? I was thinking something along the lines of:
Initialize Kinect > When Kinect ready then scan for skeleton > when skeleton detected, mark boolean value as ‘true’ > when value true, turn light on.
I know that is very vague, but I am new to developing with the kinect and overall my I’m still learning C#. Any help, no matter how small would be greatly appreciated!
Regards,
John.
You can’t set a simple boolean for this because the SDK’s event driven approach will return 6 skeletal structures even if they are all empty. Using a bit of LINQ and a null check will get you what you are looking for though.
Steps:
If you are wanting to get this up quick and with some flair you can utilize the sample that is included when you download the SDK Kinect Explorer. There is a skeletal viewer along with KinectSensorChooser that will allow you to have a fully functioning app with very little code.
read more about the Skeletal Viewer included with this sample here
I stumbled a little bit with wether to provide code for this or not. I thought it better to answer this with the logic needed to perform the action rather than the actual code… since you asked 🙂 however, if you want code for this you can either get it from Channel 9’s Quickstarts or my book chapter four
Edit (Extending KinectExplorer):
In order to extend KinectExplorer to respond when a skeleton is detected just find the function KinectAllFramesReady in KinectSkeletonViewer.xaml.cs. Inside of this function there is a bool check for haveSkeletonData, this if statement will get called when there is a skeleton present in the viewable frame of the Kinect.
so: