Microsoft Kinect + Telldus Tellstick

I was hoping someone could help point me in the right direction.

I am looking for a way to use Microsoft Kinect to turn off the lamp. The lamp is connected to the Home Easy switch, which is connected to the Telldus Tellstick. I am using C # to write an 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 about something like: Initialize Kinect> When Kinect is ready then scan the skeleton> when skeleton is found mark boolean as "true"> when true turn on lights.

I know this is very vague, but I am new to development with kinect and in general I am still learning C #. Any help no matter how small would be greatly appreciated!

Regards, John.

+3


source to share


1 answer


You cannot set this to a simple boolean, because the SDK event based approach will return 6 skeletal structures even if they are all empty. Using LINQ bits and null check will give you what you are looking for.

Steps:

  • Initialize Kinect (I would use the included KinectSensorChooser for this WPFViewers app) enable and register skeleton stream.
  • In a skeletal event check to make sure you didn't get a null skeletal collection (this happens)
  • Use LINQ to get the first skeleton that has a tracking property to track. You can also use a for loop, I just think LINQ will be useful for these types of iterations.
  • If your skeleton after LINQ query is not null then do something.

If you want to get this fast and with some flair, you can use the sample that is included when you download the KK browser. There is a skeletal viewer along with the KinectSensorChooser which will allow you to have a fully functioning application with very little code. read more about the skeleton viewer included in this sample here




I stumbled a bit to provide the code for this or not. I thought it would be better to answer this with the logic needed to perform the action rather than the actual code ... as you asked :) however if you want the code to do this you can either get it from Channel 9 Quickstarts or my book chapter four




Edit (KinectExplorer Extension):

To extend the KinectExplorer to respond when a skeleton is found, just look for the KinectAllFramesReady function in KinectSkeletonViewer.xaml.cs. Inside this function there is a bool check for hasSkeletonData, this if statement will be called when a skeleton is present in the visible Kinect frame. So:

   private void KinectAllFramesReady(object sender, AllFramesReadyEventArgs e)
   {
    //Checking for Skeleton
    if (haveSkeletonData)
    {
     //Do Stuff Here
    }
   }

      

+1


source







All Articles