Getting the Kinect SDK for working with visual studio 2010 in C ++

I followed the manual that Microsoft developed to configure the Kinect SDK using C ++. The steps they created are as follows.

  • Include windows.h in the source code.
  • To use the NUI API, enable MSR_NuiApi.h. Location: Program Files \ Microsoft Research KinectSDK \ inc
  • To use the Kinect Audio API, enable MSRKinectAudio.h. Location: Program Files \ Microsoft Research KinectSDK \ inc
  • Link to MSRKinectNUI.lib. Location: Program Files \ Microsoft Research KinectSDK \ lib
  • Make sure the beta SDK DLLs are in your path when starting your project. Location: \ Program Files \ Microsoft Research KinectSDK

I believe that I have done everything except step 5. Can someone give me more detailed information about what this means and how to do it?

thanks in advance John

+6
source share
3 answers

2.To use the NUI API, enable MSR_NuiApi.h. Location: Program Files \ Microsoft Research KinectSDK \ inc

To do this, you probably want to add this path to your project

  • Right-click on your project, properties, VC ++ directories
  • Add ;C:\Program Files\Microsoft Research KinectSDK\inc to the end of the included paths
  • Add ;C:\Program Files\Microsoft Research KinectSDK\lib to the end of the library paths

then add

 #include <MSR_NuiApi.h> 

to include at the top of the source file. If you use precompiled headers, you should put it below stdafx.h, or just add it instead of stdafx.h.

5. Make sure the beta SDK DLL files are in your path when starting your project. Location: \ Program Files \ Microsoft Research KinectSDK

This means that your binary must be able to find these files at runtime.

The easiest way to do this is to add them to your system path; switch to

  • menu
  • right click computer properties
  • advanced system settings
  • Environment Variables
  • PATH, in the user or system settings - edit and add ; then specify the path

You may then need to restart Visual Studio to select this, or it must be registered when opening a new command line.

Or, if you do not want to change the system settings, you can, for example, add it to the open command line with

 PATH=%PATH%;C:\Program Files\Microsoft Research KinectSDK 

or you can pinpoint which files are needed and copy them to the same directory as your binary, etc.

+5
source

To implement a C ++ application

  • First include windows.h in the source code. (This is important - you cannot define WIN32_LEAN_AND_MEAN anywhere in your project, otherwise you cannot compile NuiApi.h )

  • Include <NuiApi.h> in the source code.

  • Make sure your environment has an environment variable set that reflects the path to the SDK file. Installing the SDK should automatically do this for you. Example:

      KINECTSDK10_DIR = "C:\Program Files\Microsoft SDKs\Kinect\v1.0\" 
  • Go to the settings of the Visual Studio project in the VC ++ directories. Add $(KINECTSDK10_DIR)\inc to include directories.

  • In the same VC ++ directory area, include $(KINECTSDK10_DIR)\lib\x86 (for 32-bit applications) or $(KINECTSDK10_DIR)\lib\amd64 (for 64-bit applications) in your library directory.

+5
source

We use the Kinect SDK version 1.0, and this is how the project is configured. Please note that the developer's machine is Windows 7 x86. If you are using x64, change the path accordingly.

Step 1 Copy the header files and libraries. There is a reason for this: the project can be checked on any machine and compiled just fine (the machine does not need to install the SDK). Another advantage: we updated the SDK to version 1.0, but since our project was not updated and the deadline was right, we had to build it with a beta version of the SDK, and everything went smoothly.

I suggest you create a new directory in your solution called "3rdparty / KinectSDK" (change it according to your needs).

Copy C:\Program Files\Microsoft SDKs\Kinect\v1.0\inc

Copy C:\Program Files\Microsoft SDKs\Kinect\v1.0\lib (you will have x86 and x64 libraries)

Step 2 Set up a project. You will need to do this for every project that uses the Kinect SDK! All configuration takes place in the Project Properties dialog box.

C / C ++> General> add " $(SolutionDir)\3rdparty\KinectSDK\inc " to your additional Include directories

Linker> General> add " $(SolutionDir)\3rdparty\KinectSDK\lib\x86 " to your additional library directories (if you are configuring for x64, use the amd64 directory)

Linker> Input> add " Kinect10.lib " for additional dependencies

Step 3 Compilation time!

Note:

  • If you install the SDK correctly, your computer will be able to run / debug the program without further configuration.
  • To run the program on the client machine, you need to copy the Kinect10.dll file. It is best to create a deployment project, the DLL will be detected automatically for you.
  • Speaking of a client machine, you do not need to install an SDK for it. Just take the driver files (.inf, etc.) and install the driver manually when you connect Kinect.

Good luck.

+1
source

Source: https://habr.com/ru/post/899724/


All Articles