Setting up your Development Environment

Download this episode

Download Video

Description

In setting up your development environment we'll discuss the following topics:

  • The basics of using the Managed API
  • The key developer resources to use in your application like the KinectWpfViewers that ship Kinect SDK Kinect Explorer sample and the Coding4Fun Toolkit for skeletal scaling that will be used in later Quickstart videos.
  • Demos of how to manage and connect to a Kinect using the KinectSensors collection and using the KinectSensorChooser WPF control

 

Notes:

  • Please make sure to use the Quickstart Samples as in the video we did not include two code checks that you'll want to add to your application

Add a check for null on newSensor

private void kinectSensorChooser1_KinectSensorChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            KinectSensor oldSensor = (KinectSensor)e.OldValue;

            StopKinect(oldSensor); 

            KinectSensor newSensor = (KinectSensor)e.NewValue;
         
           //NOTE: Add this check for a null sensor
            if (newSensor == null)
            {
                return; 
            }

            //register for event and enable Kinect sensor features you want
            newSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(newSensor_AllFramesReady);
            newSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
            newSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30); 
            newSensor.SkeletonStream.Enable();


            try
            {
                newSensor.Start(); 
            }
            catch (System.IO.IOException)
            {
                //another app is using Kinect
                kinectSensorChooser1.AppConflictOccurred();                 
            }


        }
 

 

Add a check to see if the sensor is running and if the AudioSource is null

            if (sensor != null)
            {
               //NOTE: Add this code
                if (sensor.IsRunning)
                {
                    sensor.Stop();
                    if(sensor.AudioSource != null)
                   {
                       sensor.AudioSource.Stop();
                   }
                }
            }

Resources

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      Tim

      Is there a 'cheat sheet' version of these videos - find them very time consuming to go though - keep having to pause and rewind to get details - would rather go through a written step-by-step guide.

      Thanks.

    • User profile image
      Varma

      Coding4Fun Toolkit link is not working. Please fix.

    • User profile image
      Dan

      @Varma: Thanks for the heads up, the link is now fixed, it should point to http://c4fkinect.codeplex.com/ 

    • User profile image
      myChan

      Thanks for this resource! I really enjoy watching this Big Smile

       I have a question about this section.Is this the feature for windows kinect? When I test it in Xbox kinect, UnhandeledException Problem is occured at the sensor.AudioSource.Stop();
      And IR emitter is still working after the debugging mode is ended.

      Is there any solution to solve this problem? Anyways, Thanks!

    • User profile image
      Dan

      @myChan:Hey myChan, were you using the quickstart samples or typing the code as-is? We did add two notes that weren't in the video but *are* in the quickstart samples (see above). If you're still getting an exception with these two additions, let me know and I'll try to repro this.

       

      Cheers!

      -Dan

    • User profile image
      myChan

      @Dan: Thanks for replying.But still not working... I found the difference between the sample and mine is

      using Coding4Fun.Kinect.Wpf; and if(sensor.IsRunning){} section.

      Of course, the execution is fine. but when I unplug this(I try the way both usb cable and power adapter), NullreferenceException Ploblem is occured. Oh, and I got something to ask you. Is the usb cable using the main powerline of Xbox Kinect? I unplugged the usb cable, The Kinect`s power turned off and VS2010 got the error. 

      Anyways, I`ll try it as possible as i can. Thanks! 

    • User profile image
      Dan

      @myChan:Try the suggested code at the top of the file and tell me if you still get the exception. Thanks, -Dan

    • User profile image
      myChan

      @Dan:Wow! It worked. Thanks a lot! I appreciate that.

    • User profile image
      Dave509

      Dan - For someone who has little programming experience (vb script), what programming language should I be focusing on learning to bring me up to speed with the programming here? Would it be Microsoft Visual Studio .NET? If so do you recommend any online training resources? Thanks!

    • User profile image
      gduncan411

      @Dave509:I know you asked Dan, but...

      From my seat, I'd suggest C#, as there are more examples and samples for it. To learn C#, check out, http://channel9.msdn.com/Series/C-Sharp-Fundamentals-Development-for-Absolute-Beginners

      That said, VB.Net is fully supported and viable for the Kinect and there's more samples and examples on the way. To get going with VB.Net, check out, http://channel9.msdn.com/Series/Visual-Basic-Development-for-Absolute-Beginners

      Another nice learning/training resource is http://msdn.microsoft.com/en-us/VS2010TrainingCourse

      Hope this helps.

    • User profile image
      Dave509

      @gduncan411: Thanks for the quick response and great information. I will take your advice and start with C#. I am hoping that this will make it easier for me to begin developing for the Kinect.

    • User profile image
      Yassine

      Is it possible to use the Kinect with a Metro Style Application in Windows 8 ?

    • User profile image
      fdomig

      Hi,

      I am already having a prblem getting my Kinect sensor to be recognized. I followed your steps until starting the first debug session, but I am not getting a sensor (KinectSensor.KinectSensors.Count is 0). I am using an old Xbox360 sensor which is installed properly and recognized by Windows itself (at least I see the NUI Motor but nothing more). The SDK is installed, the references to the project are set and actually everything seems to be correct.

      Is there something different with the old Kinect sensor the be aware of?

      Thanks.

    • User profile image
      Maurice

      Do u have a more up to date demo, the code is based on the beta sdk, looking for demos related to the Feb 1st release, the libraries have different names ie. using microsoft.kinect vs microsoft.research.kinect etc. there is no documentation of the changes, i'm assumming this is a new naming convention etc.

    • User profile image
      Marco Shaw

      @Yassine: You can code Metro apps in various languages, and C# is one of them.

    • User profile image
      DrWave

      I have been trying out my new Kinect SDK with the VB code samples. I finally found updated samples for the new SDK. I can get the programs too build and run but I cannot edit the forms. I get error:

      Error 1 The type 'my:KinectColorViewer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\vsingh\Documents\Kinect\KinectforWindowsSDKV1\KinectforWindowsSDKV1\3.Camera Fundamentals\CameraFundamentalsVB\CameraFundamentals\MainWindow.xaml 8 10 CameraFundamentals Error 2 The type 'my:KinectSensorChooser' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\vsingh\Documents\Kinect\KinectforWindowsSDKV1\KinectforWindowsSDKV1\3.Camera Fundamentals\CameraFundamentalsVB\CameraFundamentals\MainWindow.xaml 9 10 CameraFundamentals

      I am migrating from VB6 ! And I assume I am missing the references to thesae two components but how do you set that ? Thanks for the nice tutorial videos. 

    • User profile image
      Dan

      @Maurice:I'm not sure what you're talking about, all of the demos for this series of Quickstarts are for the Feb 1st SDK. What specific demos don't work with the Feb 1st release?

    • User profile image
      Dan

      @fdomig:If, under Device Manager, you see "NUI Motor", then you have the wrong driver. Check your add remove programs and uninstall any other drivers you may have (Kinect Beta 2, PrimeSense, etc), and try re-installing the Kinect SDK 1.0. I just tested this with an Xbox 360 Kinect and I see the following in Device Manager

      • Microsoft Kinect Audio Array Control
      • Microsoft Kinect Camera
      • Microsoft Kinect Device
      • Microsoft Kinect Security Control
    • User profile image
      Dan

      @Yassine:The Kinect SDK is currently designed only to work with desktop applications, not Metro-style applications. One option is to get Kinect data over the network as network data can be consumed by a Metro Style application. For an example project, check out the Kinect Service project - http://kinectservice.codeplex.com/ 

    • User profile image
      Hari

      @Dr.Wave: were you able to solve the problem? I have the same problem with the samples. Error 1 The type 'my:KinectColorViewer' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. C:\Users\vsingh\Documents\Kinect\KinectforWindowsSDKV1\KinectforWindowsSDKV1\3.Camera Fundamentals\CameraFundamentalsVB\CameraFundamentals\MainWindow.xaml 8 10 CameraFundamentals Error 2 The type 'my:KinectSensorChooser' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been

      I see this in C#, can someone please help

    • User profile image
      gduncan411
    • User profile image
      Dan

      @Hari: In Visual Studio, try clicking the Build option first. Once you click Build, the references should show up in the right places.

    • User profile image
      seggemu

      Dan the videos are really nice, I really appericiate your work from the kinect quick start videos using the nui and now sdkv1 Big Smile, I am happy and with your videos my final year project for my under graduation i will be showing my college kinect application.

      Dan, can we use kinect to remotely access desktop pc of windows 7, is it possible through internet without using azure services, please do post a link as to help in this situation Big Smile

      thank you DAN

    • User profile image
      vivian

      Hello,after 12 minutes 52 seconds in the video,what operation does the demonstrator take to pop the mainwindow&#63; then,after he says&#34;we don&#39;t see anything ,that&#39;s a good sign&#34;,what shortcut key does the demonstrator press to make the kinect sign appear in the blank mainwindow suddenly&#63;thank you&#126;&#126;

    • User profile image
      ryanrs

      I was following along with the video and I was having a problem getting the KinectSensorChooser on the window. I know how to add something to a window, its just that it will not allow me to drag it onto the window. I decided to just run the Quickstart Sample and it gives me the following:

      Error 1 The type 'my:KinectSensorChooser' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

      I attempted to delete the Microsoft.Samples.Kinect.WpfViewers project, re-add it and re-add the resources and rebuild but I get the same error.

      Thanks,
      Ryan

    • User profile image
      ryanrs

      I figured out my problem.

      1. When I downloaded the Quickstart Samples before I extracted the zip I needed to right-click and click unblock (on the general tab). This didn't get rid of the error and I still could not drag and drop the KinectSensorChooser

      2. I needed to run the project outside of my user directory (I'm on a university computer) so once I got out of my user directory I could then drag and drop the KinectSensorChooser

      Hope this helps someone else
      Ryan

    • User profile image
      Dan

      , seggemu wrote

      Dan, can we use kinect to remotely access desktop pc of windows 7, is it possible through internet without using azure services, please do post a link as to help in this situation Big Smile

      thank you DAN

      @seggemu: If I understood you correctly, you want to be able to access Kinect data (like color, depth, skeletal, and audio data) on a remote machine. The good news is that we have solved about half of the problem. Brian Peek, from our Coding4Fun team built KinectService - http://kinectservice.codeplex.com that exposes Kinect data via sockets so that you can see Kinect data via a network using sockets. As one example, he shows how you can run the Kinect Service and see the live video feed on a Windows Phone. The challenge here is that the data is exposed via sockets so you'll need a way to see that data that will work well across the Internet, through firewalls, and so on. For some scenarios, you may be able to just open up a port on your firewall and mapping it to the port Kinect Service uses for communication. But you should be aware that there is no explicit security for this so someone who knows that port number could also connect and watch your feed. Using Windows Azure (or some other intermediary) is an option too, but it all depends on your needs. Hope this helps

    • User profile image
      Dan

      @vivian:

      Hello,after 12 minutes 52 seconds in the video,what operation does the demonstrator take to pop the mainwindow&#63; then,after he says&#34;we don&#39;t see anything ,that&#39;s a good sign&#34;,what shortcut key does the demonstrator press to make the kinect sign appear in the blank mainwindow suddenly&#63;thank you&#126;&#126;

      Hi Vivian,

      Good question and sorry if that wasn't clear. If the KinectSensorChooser is running correctly, then the Kinect image should *not* appear. To make it appear, I didn't hit a shortcut key, I simply unplugged the Kinect's USB cord from my laptop.

    • User profile image
      mavegap

      Hi Dan,
      Thanks for the videos. I have a problem when I'm running the example, I got a message saying System.NotImplementedException and that the file 'MainWindow.xaml.cs' is not located. Why do I have this error? did I miss something?

      Thanks!

    • User profile image
      fdomig

      Hi Dan,

      Thanks for your reply. Removing the SDK beta driver driver and installation of the new one fixed the problem and I am able to start developing now. Great!

      Thanks,
      Franky

    • User profile image
      Dan

      @mavegap:Which example are you working on and where is the NotImplementedException thrown?

    • User profile image
      Molcavian

      Hi Dan,

      Have a question.  Everything was going fine until 9:50 into your second video where you casually right click and add a "KinectSensorChooser" from the the toolbox.

      I don't see this component, and if I chose View All I see it, but its greyed out and I can't add it?

      Any ideas?  I have downloaded the SDK, installed it, unpacked the Kinect Explorer files and added both the WPF project to my solution as well as adding a reference to my other project.

      No matter what I do I just can't see to get access to this.

       

      Craig

    • User profile image
      Molcavian

      Well I sorted it out. 

      It has to do with a little quirk in VS2010 / Windows, if you have files you are referencing buried far down in a folder structure which is many levels deep you can have issues.  VS can't copy with include or reference pathds that exceed 260 characters in length.  As it couldn't build the supporting Kinect Explorer WPF project it couldn't have access to the KinectSensorChooser.  As soon as you move your VS Solution to a folder closer to the root of your hard drive it builds np!.

      I have found this series excellent, but some basic steps are missing and assumptions made about knowledge.  For the total novice I have written a little guide to Getting, Installing and Configuration your system, both Hardware & Software ready for development with Windows Kinect Sensor, SDK V 1.0 and VS2010.

      http://www.21stcenturyclassroom.co.cc/

       

       

       

       

    • User profile image
      Muhamad Badawy

      Hi Dan,
      I'd like to thank you for your great effort . I want to ask about the ability of defining the 3d objects and controlling them. Can we use Xna+kinect for that purpose ???


      Thanks in advance.
      Muhammad

    • User profile image
      Nina

      I want to reproduce your samples in Windows Forms.
      Is there any chance to get the toolbox controls from Microsoft.Samples.Kinect.WpfViewers like the KinectSensorChooser also for WinForms?

    • User profile image
      Ahmed Al Mowalad

      Hi, first I really appreciate your work here and this great series that make is so easy for developers to develop KINECT apps but I have a small question since am still new to the visual studio, how can I add the KINECT reusable controllers that you have used in the video, thank you in advance :)

    • User profile image
      Laurence

      Hi, I want to ask if someone would be kind enough to point me where I can find the complete reference for the kinect sdk library? Thanks

    • User profile image
      Amanda

      Hi, I probably sound like a total newbie asking this, but, well I am. I noticed in your videos when you typed in "if (" it automatically added the second bracket, and once you started typing it, the } below was changed to { so you could write the next line. Mine doesn't do that - how comes? Have you downloaded something which edits the () and {} as you go?

      Sorry if this is a dumb question, I am a total beginner and need to use kinect for my degree show in May so I'm trying to learn all this as fast as I can!

      Amanda

    • User profile image
      Amanda

      For any complete beginners out there who are trying this tutorial and get stuck at the KinectSensorChooser bit because it looks greyed out:

      I tried doing what everyone else said on this list and nothing worked. I spent at least an hour worrying over it and scouring google for answers only to stumble upon it myself. It's the stupidest thing ever and it makes me look like a total lemon for not realising but for all the other lemons out there here's what I missed:

      First, go to Debug>Build Solution. If theres any errors, follow the tips the guys above gave you. If theres NO errors but it looks grey you might have missed the one lil thing I missed: I didn't notice Dan clicked on the MainWindow.xaml* tab. Voila, no longer grey.

      Stupidest thing every but just to save anyone with this problem a few hours of worry, there it is!

      In regards to my other post, I have been writing the code using tab and enter but I really would like to have it auto-complete or whatever the term is, so if anyone knows how to get it to do that please let me know!

      Thanks Dan for your tutorials, they have been really good so far. Lots of little things missed out for beginners like me but then you said it's not geared at beginners, so...

    • User profile image
      Sketchy

      Hi,

      Thanks for your tutorials Dan! I have followed everything up to 13:00:00 and it was fine, but when I pressed Run it said that there was an error with newsensor.Stop. I added in the extra coding you put under the videos as you told someone above to do, but now when I press F5 it says "The name newSensor_AllFramesReady does not exist in current context"

      Im pretty sure I followed everything properly in the tutorial, and looking around on google everyone else seems to use this name just fine.

      It seems essential to the program and it just won't work, I have no idea what to do!

      I also don't know what you mean when you say "Please use the Quickstart Tutorials" I thought that was what I was doing by following this... What do you mean??

      Please can you or anyone else on here help, I would be so grateful!!

    • User profile image
      Sketchy

      Solved!

      http://stackoverflow.com/questions/9790701/can-anyone-help-resolve-newsensor-allframesready-does-not-exist-in-current-cont

      If anyone has this problem, just make sure you go through all your code and change ALL "_sensor" references to "newSensor" - thats why it said to me that newSensor_AllFramesReady didn't exist, because it was trying to find the later instruction
      void newSensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
      {
      but all it could find was void _sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
      {

      Check all your code uses newSensor, and it should run properly!

    • User profile image
      Dan

      ... I want to ask about the ability of defining the 3d objects and controlling them. Can we use Xna+kinect for that purpose ???
       

      There's nothing built into Kinect for 3D object manipulation or identification, but here's an example where 3D objects were manipulated in XNA using your hand position -  http://kinectearthmove.codeplex.com/. I don't know if this has been updated to Kinect SDK 1.0, but this at least gives you a starting point.

    • User profile image
      Dan

      @Ahmed Al Mowalad: With a new project open, in the Solution Explorer, right click on the Solution Name (the first item in the tree view on the right pane that lists all of the files in your project) and select add Existing Project and select the WPF Viewers project that is included in the SDK or included in the Kinect Quickstarts. you may need to click Build afterwards.

    • User profile image
      Dan

      Hi, I want to ask if someone would be kind enough to point me where I can find the complete reference for the kinect sdk library? Thanks

      @Laurence:It's included when you install the SDK in a CHM doc file name Kinect SDK documentation

    • User profile image
      Giuliano Giacaglia

      I'm trying to add the KinectSensorChooser to the main window, but there is no such a object in my Toolbox. I already added a reference to the Microsoft.Samples.Kinect.WpfViewers dll, but I don't see the object in my toolbox.

      The only object that is present is KinectSkeleton. And oddly it's the only code under the Microsoft.Samples.Kinect.WpfViewers that is a .cs file. I guess the problem is that the other objects are of the type .xaml. But I can't figure out what. Does anyone have a good idea of what's going on?

    • User profile image
      Giuliano Giacaglia

      Somehow now the KinectSensorChooser is now in the Toolbox.. This is odd.

    • User profile image
      Hemanth

      Hi

      My application crashed when I unplugged the connect to test the program and when I try to reconnect the kinect to the PC, the kinect green light does NOT come on. If I run the program again, it says "plug my power cord in". The PC does not recognize kinect unless I restart the it. I think there must be some process lingering on the computer that needs to be killed. Do you know how to overcome this error without a PC restart.

      Thank you

    • User profile image
      Eric BD

      Hi Dan,

      Thanks for the tutorials! However I've run into a problem: I followed all your steps and everything worked just fine until I unplugged the Kinect sensor. I got a "NullReferenceException was Unhandled" error.

      Any ideas?

      Thanks Dan.

    • User profile image
      Eric BD

      Hi Dan,

      I managed to solve my own problem. Yay! After trying in vain to get the code in the video to work, regarding the newSensor object, I decided to try the following, and it worked like a charm:

      KinectSensor newSensor = (KinectSensor)e.NewValue;
      if(newSensor != null)
      {
      newSensor.ColorStream.Enable();
      newSensor.DepthStream.Enable();
      newSensor.SkeletonStream.Enable();
      newSensor.AllFramesReady +=
      new EventHandler<AllFramesReadyEventArgs>(_sensor_AllFramesReady);

      newSensor.Start();
      }

      The KinectSensorChooser showed up when I unplugged the cable, and showed the sensor as "Initializing..." when I plugged the cable back in!

      I hope this helps somebody else who was having similar problems to mine.

      Thanks for the videos, Dan.

    • User profile image
      Tom

      ^^ Thanks Dan for the code. Really appreciate it. Finally got the next part in the video to work. :)

    • User profile image
      Tom

      ^^ Sorry I meant Thank you Eric for the code.

    • User profile image
      Eric BD

      @Tom - hey, I'm glad I was able to help someone else!

    • User profile image
      Mike Hahn

      Hi,

      Is anyone else having problems with the link above to the Quickstart Samples? When I click on it I get "The Website cannot be found",

      Thanks,
      Mike

    • User profile image
      Dan

      Somehow now the KinectSensorChooser is now in the Toolbox.. This is odd.

      [/quote]

       

      You probably needed to build the project first as that's the only way they'll appear.

    • User profile image
      Cliften Bowers

      The Link for the Quickstart Slides and Samples is broken

    • User profile image
      Dan

      @Cliften Bowers: This should be fixed now

    • User profile image
      Renato​Ribeiro

      Hi,

      I tried averything that says here.

      I am at MainWindow.xaml window and the KinectSensorChooser doesn't appear greyed, but when i try to drag it into MainWindow doesn't appear the image of "Kinect for Windows".

      I tried to drag the others and nothing too.

      Help plz.

    • User profile image
      Dan

      @RenatoRibeiro: Go to the XAML view and ensure that the Sensor control is included.

    • User profile image
      Zakkar

      Hello

      PLease i don't know what happen but i get this Error
      1 The name 'kinectSensorChooser1' does not exist in the current context

      and this is my function

      private void Window_Loaded(object sender, RoutedEventArgs e)
      { kinectSensorChooser1.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged);
      }

      how can i fix it?

      Thank you

    • User profile image
      Dan

      @Zakkar: Is this a custom project or the built-in sample? If it's a custom project, you will need to Right click in Solution Explorer to add a new project and add the WPF Viewer project that is available in the samples or ships in the Kinect Explorer SDK sample.

       

      Once you do that, drag and drop the KinectSensorChooser control onto the MainWindow design surface as shown in the video.

    • User profile image
      Eric

      Hallo,

      if build the same he has in this video, but the binding on the colorViewer deosn't work. I bind it on the same way he has(Elementname SensorChooser1 -> Path Kinect), but in my app you see nothing. The SensorChosser works, but the ColorViewer not. He compile and build well, no errors, but it show me nothing.

      Anywhere an idea why it dosn't work?

    • User profile image
      Dan

      @Eric: Do any of the other viewers work?

    • User profile image
      Yahoo jones

      Word. you talk so fast and jump around between what your thinking about doing next and what we are suppose to be doing now. a cheat sheet of some kind would help.

    • User profile image
      BigTeeJay

      Has anyone other than Molcavian had a problem getting the viewers into the toolbox?
      http://channel9.msdn.com/Series/KinectQuickstart/Setting-up-your-Development-Environment#c634662205139236027
      I had it in a path that was 79characters long, I moved it to one just below C: that is 15 characters long, and it still isn't working.

      I added a reference to the wpf version of the dll (matching my c# wpf project). After building the project, they didn't appear.

      I created a tab group ("Kinect"), selected "choose items", browsed to the dll, it showed the half dozen or so viewers (already checked), I hit ok, and the tab group disappears.

      I thought perhaps this was related to the version of .Net that was being targeted. The default for my project was v4 client profile. I tried v4, v3.5, etc... none of them work (all but v4 worked worse, obviously).

      Is there something I'm missing here? I closed and reopened all instances of VS (thinking something buggy may have occured). I also reset my toolbox. If I try creating another "Kinect" tab group, it says one already exists.

      This is VS 2010, 10.0.40219.1 SP1Rel with a Kinect for Windows.

    • User profile image
      BigTeeJay

      Oh my word, make a liar out of me.

      After deleting the reference in folder just below C:, I deleted and re-added the Release binary of the wpf viewers again, then reset my toolbox, created "Kinect" tab, chose items, hit ok... and now they're usable.

      Wish I know what changed so I could document it in case anyone else has the same issue, sorry. :(

    • User profile image
      BigTeeJay

      Ok, feeling validated, though frustrated ;)

      I got them to appear in a new WPF test project, but I can't get them to appear (yet) in my actual development project.


      UPDATE: Deleted reference, added reference, reset toolbox, created Kinect tab, choose items, hit COM Tab, back to WPF tab, Enter. Closed VS, reopened, opened my project.

      Now they appear.

      *phew*

    • User profile image
      zhang

      link error 2019 __imp__NuiCreateSensorByIndex@8
      I use C++. i have link Kinect10.lib.

      plz help

    • User profile image
      zhang oliver

      this's my problem:

      error LNK2019: unresolved external symbol __imp__NuiCreateSensorByIndex@8 referenced in function

    • User profile image
      oliver zhang

      my project http://test.tigerdrs.com/blank.rar .plz watch

    • User profile image
      Dennis

      great tutorial and thx to Molcavian, i had the same problem.

      use: win7 pro 32bit, kinect for xbox 360, sdk 1.5.0.0, visual studio 2010

      problem: it seams "Microsoft.Samples.Kinect.WpfViewers" changed -> there is no "KinectSensorChooser" left in "Toolbox" and the "KinectSensorManager.cs" also doesn't appear

      it's an Wpf Project, Microsoft.Kinect.dll is referenced, dependencies are set, cleaned and new buildet

      what did I wrong, forgot or what ever?
      has anybody a hint?

    • User profile image
      DrWaky

      Hi Dennis, I've got the same problem, the "KinectSensorChooser" no exist... I don't know what must to do.

    • User profile image
      kinectIsBoss

      I'm with Dennis and DrWaky,
      I've got the 1.5 Kinect SDK and referencing the WPF Viewer sample in that package doesn't make the KinectSensorChooser tool available.

      I just ordered my Kinect power adapter, so I'm hoping to have this figured out soon, so I'm ready to roll when it gets here.

      Suggestions on another project to find it in??

    • User profile image
      GilC

      I was running into the same problem where I was using the KinectWpfViewers that was installed with the install of the KinectExplorer. This KinectWpfViewers library evidently is a newer/different version that does not include the KinectSensorChooser.

      After spending a good part of the day trying to figure out the problem, I discovered that the correct WpfViewers project to use that has the KinectSensorChooser control is actually located in the Dependencies/KinectWpfViewers folder that is delivered with the KinectforWindowsSDKV1.

      Also, I was trying to build an x64 version of the Application and KinectWpfViewers but I had a problem where the Xaml Designer would not accept the x64 version of the controls.

      Hope this helps someone.

    • User profile image
      GilC

      Ok, I was finally able to complete the steps explained in the video and made the appropriate changes as stated above. Just a warning to everyone who created their own new project as I did, take a look at the Getting Started samples in the KinectforWindowsSDKV1 folder for this video (2.Setting Up Dev Envirnment). There are more changes to be made to the MainWindow.cs than is shown above.

      But even after I changed my project to match the sample, I was still getting an exception when I unplugged the Kinect and VS would abort. However, building the Release version and running it outside VS, everything worked as shown in the video. Don't know why the exception occurred when running a Debug version in VS 2010.

      Again, maybe this little bit of info helps someone else.

    • User profile image
      Perry

      After installing Kinect for Windows SDK 1.5 and following the video, the KinectSensorChooser is actually missing from the Toolbox. Please explain how to deal with the sensor choosing issue. THanks.

    • User profile image
      Tom

      This is getting ridiculous... I am experiencing the same issue with the KinectSensorChooser. Can someone clearly explain how to solve this issue?

    • User profile image
      Tom

      Changed the application's target framework from 4.5 to .NET Framework 4 Client Profile and rebuilt it. That seemed to do the trick...

    • User profile image
      Thomas

      If there is anyone still having trouble, you need to download this: http://files.ch9.ms/coding4fun/KinectforWindowsSDKV1.zip You should add the Microsoft.Samples.Kinect.WpfViewers from the downloaded document. Add this project, the Coding4Fun.Kinect.Wpf.dll and Microsoft.Kinect references to your named project. The KinectSensorChooser should be showing. This should be your final code:


      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Windows;
      using System.Windows.Controls;
      using System.Windows.Data;
      using System.Windows.Documents;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Windows.Media.Imaging;
      using System.Windows.Navigation;
      using System.Windows.Shapes;
      using Microsoft.Kinect;
      namespace KinectSetup
      {
      /// <summary>
      /// Interaction logic for MainWindow.xaml
      /// </summary>
      public partial class MainWindow : Window
      {
      public MainWindow()
      {
      InitializeComponent();
      }



      private void Window_Loaded(object sender, RoutedEventArgs e)
      {

      kinectSensorChooser1.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged);




      }

      void kinectSensorChooser1_KinectSensorChanged(object sender, DependencyPropertyChangedEventArgs e)
      {
      KinectSensor oldSensor = (KinectSensor)e.OldValue;
      stopKinect(oldSensor);

      KinectSensor newSensor = (KinectSensor)e.NewValue;

      /*
      newSensor.ColorStream.Enable();
      newSensor.DepthStream.Enable();
      newSensor.SkeletonStream.Enable();
      newSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(zeroSensor_AllFramesReady);
      * */

      //NOTE: Add this check for a null sensor
      if (newSensor == null)
      {
      return;
      }



      //register for event and enable Kinect sensor features you want
      newSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(newSensor_AllFramesReady);
      newSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
      newSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
      newSensor.SkeletonStream.Enable();


      try
      {
      newSensor.Start();
      }
      catch (System.IO.IOException)
      {

      kinectSensorChooser1.AppConflictOccurred();
      }

      }

      private void newSensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
      {
      //throw new NotImplementedException();
      }

      void stopKinect(KinectSensor sensor)
      {

      if (sensor != null)
      {
      //NOTE: Add this code
      if (sensor.IsRunning)
      {
      sensor.Stop();
      if (sensor.AudioSource != null)
      {
      sensor.AudioSource.Stop();
      }
      }
      }

      }



      void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
      {

      stopKinect(kinectSensorChooser1.Kinect);


      }
      }

      }

    • User profile image
      tenonic

      Working code that doesn't error out when you unplug the usb cable:

       

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows;
      using System.Windows.Controls;
      using System.Windows.Data;
      using System.Windows.Documents;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Windows.Media.Imaging;
      using System.Windows.Navigation;
      using System.Windows.Shapes;
      using Microsoft.Kinect;

      namespace KinectForDev
      {
      /// <summary>
      /// Interaction logic for MainWindow.xaml
      /// </summary>
      public partial class MainWindow : Window
      {
      public MainWindow()
      {
      InitializeComponent();
      }

      //KinectSensor _sensor;

      private void Window_Loaded_1(object sender, RoutedEventArgs e)
      {
      kinectSensorChooser1.KinectSensorChanged += kinectSensorChooser1_KinectSensorChanged;
      }

      void kinectSensorChooser1_KinectSensorChanged(object sender, DependencyPropertyChangedEventArgs e)
      {
      KinectSensor oldSensor = (KinectSensor)e.OldValue;
      StopKinect(oldSensor);
      KinectSensor newSensor = (KinectSensor)e.NewValue;

      if (newSensor != null)
      {
      newSensor.ColorStream.Enable();
      newSensor.DepthStream.Enable();
      newSensor.SkeletonStream.Enable();
      newSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(newSensor_AllFramesReady);

      try
      {
      newSensor.Start();
      }
      catch (System.IO.IOException)
      {
      kinectSensorChooser1.AppConflictOccurred();
      }
      }
      }

      void newSensor_AllFramesReady(object sender, AllFramesReadyEventArgs e)
      {
      //throw new NotImplementedException();
      }


      void StopKinect(KinectSensor sensor)
      {

      if (sensor != null)
      {
      //NOTE: Add this code
      if (sensor.IsRunning)
      {
      sensor.Stop();
      if (sensor.AudioSource != null)
      {
      sensor.AudioSource.Stop();
      }
      }
      }

      }

      private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e)
      {
      StopKinect(kinectSensorChooser1.Kinect);
      }

      }
      }

    • User profile image
      Marc

      I can't find anything about Microsoft.kinect to add to the references. I've installed the SDK and the hardware is plugged in.

      I'm able to dig up Microsoft.kinect.dll, but that's probably not the same thing.

      Please advise.

    • User profile image
      Marc

      I've gotten past my previous problem, I'm having another one though.

      Like a lot of other people I can't use
      kinectSensorChooser1
      It just doesn't show up as an option. I've tried everything. Everything is referenced properly.

      Any ideas?

    • User profile image
      Marc

      Just to clear up my last post, I'm able to drag and drop the KinectSensorChooser into MainWindow.xaml but when it comes to referencing it in MainWindow.xaml.cs then it doesn't show up.

      I've literally done everything mentioned by others and can't get it to work. I have both the project (KinectSetupDev & Microsoft.Sample.Kinect.WpfViewers) in the Solution Explorer and the first is referencing the second. But it's still not showing kinectSensorChooser as an available option.

    • User profile image
      Ryan

      Where could I get the codes of these videos? I‘m new to Kinect for Windows SDK.

    • User profile image
      Fabrizio Borgia

      Hi all, I'm using SDK V.1.6 and VS 2012.
      I finally understood (after two hours of browsing) where the damn SensorChooser IS:

      As you can read in those patch notes (I strongly suggest you to do search for the string "KinectSensorChooser" in that page):

      http://www.windows7download.com/win7-kinect-sdk/history-lxqvgakz.html

      "We’ve taken KinectSensorChooser, formerly part of the WpfViewers and split the logic and UI into two different classes: KinectSensorChooser and KinectSensorChooserUI in Microsoft.Kinect.Toolkit.dll.
      KinectSensorChooser could be used in non-WPF scenarios as it is logic only, no UI."

      So, Microsoft.Kinect.Toolkit.dll. is the place to look for!

      Hope this helps!

    • User profile image
      Pedro

      Hello!!

      I have a problem. I've used the SDK 1.6 . I can't find in toolbox the Figure kinectSensorChooser as the video show. What Do I do? Help me please!!!

    • User profile image
      Jimmy Neutron

      @Fabrizio Borgia Hi thanks for the info but how do you add the Microsoft.Kinect.Toolkit.dll. ?? I've only added Microsoft.kinect please help i'm using the SDK 1.6 and the KinectSensorChooser is NOT in the toolbox??

      Thank you.

    • User profile image
      Jimmy Neutron

      @Fabrizio Borgia I've just added the Microsoft.kinect.toolkit but the KinectSensorCooser only has two option which are: KinectSensorChooser.Equals and KinectSensorChooser.ReferenceEquals it does not allow me to write KinectSensorChooser1 :( Please help ASAP, thanks

    • User profile image
      mgoodall

      @Jimmy, right click in your Toolbox, and select "Choose Item". Navigate to the Samples/bin directory, and select the DLL.

      It would really be nice if the video was updated to show how to code with the SensorChooserUI since SensorChooser is no longer available for WPF, but I'm sure we'll figure it out :)

    • User profile image
      John

      How do we use the SensorChooserUI??

    • User profile image
      Art

      I had the same problem with SensorChooserUI and found the following

      ----------------------------------
      Just reference the compiled binary from:

      C:\Program Files\Microsoft SDKs\Kinect\Developer Toolkit v1.6.0\Samples\bin

      I'm not sure it will show up in the toolbox, but you can start using the control from WPF. Take a look at the ShapeGame sample to see how to create the WPF markup and use it from the code behind.
      ------------------
      ... at ...
      http://c4fkinect.codeplex.com/discussions/394514

      It was kind of painful but in the end I added a KinectSensorChooserUI to the main window and assigned a KinectSensorChooser object to it, then started and stopped the KinectSensorChooser object.

    • User profile image
      Bridge

      Hi!

      I have been following the videos and they have been a great help so far. I am not sure I referenced everything correctly though. I am getting an error at a couple stops where I wrote the word 'Void" in a line of code, such as the void in this line:

      private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)

      the error reads:
      Error 2 Expected class, delegate, enum, interface, or struct

      Any ideas? Thanks!

    • User profile image
      Ross

      Hi,
      I've followed the guide to the T and as other people seem to be having this problem. I have the 1.6 SDK.
      The KinectSensorChooser is showing up, yet I am not able to drop it into the main window.
      I've tried what other people have been saying but to no avail yet.

      Can anyone help?
      Thanks.

    • User profile image
      Lucas

      I just installed the 1.0 SDK and all the things are working fine... with v1.6 SDK it was not working

      I believe it can help someone with the same problem.
      Thanks.

    • User profile image
      cmdmss

      Hey guys.

       

      I was trying to do it in my computer, but when I try to drag and drop the KinectSensorChooser, the mouse pointer appear to me like prohibited. Does anyone see that before?

       

      Thanks.

    • User profile image
      Drew

      Hey,

      I've gone over my code a few times now and everything appears correct, but when running the program, each time I disconnect the Kinect, Visual Studios crashes. Has anyone experienced the same problem or know how to fix it?

      Thanks.

    • User profile image
      Archit Kalra

      Hey,

      Where can we download the kinect explorer from ?

    • User profile image
      ANN

      Hi,
      I've followed the guide the vidio and debuding, it isn't "Initializing". I saw just "required or blank". My Kinect is XBOX360 and used visual Studio 2010. why could not working? Hope this helps.

    • User profile image
      Liv3

      ANN: Same problem with me.
      Visual Studio 2010, Kinect XBOX 360

      Kinect works in the samples for SDK 1.5 but in the program nothing happens :/

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.