让 Kinect SDK 在 c++ 中与 Visual Studio 2010 配合使用

发布于 2024-12-10 18:56:37 字数 531 浏览 0 评论 0原文

我一直在遵循微软为使用 c++ 设置 Kinect SDK 所做的指南。他们创建的步骤如下。

  1. 在源代码中包含 windows.h。
  2. 要使用 NUI API,请包含 MSR_NuiApi.h。 位置:Program Files\Microsoft Research KinectSDK\inc
  3. 要使用 Kinect 音频 API,请包含 MSRKinectAudio.h。 位置:Program Files\Microsoft Research KinectSDK\inc
  4. 链接到 MSRKinectNUI.lib。 位置:Program Files\Microsoft Research KinectSDK\lib
  5. 确保运行项目时 Beta SDK DLL 位于您的路径中。 位置:\Program Files\Microsoft Research KinectSDK

我相信我已经完成了除步骤 5 之外的所有操作。任何人都可以给我更多有关这意味着什么以及如何执行此操作的详细信息吗?

提前致谢, 约翰

I've been following the guide microsoft have made for setting up the Kinect SDK with c++. The steps they have created are as follows.

  1. Include windows.h in your source code.
  2. To use the NUI API, include MSR_NuiApi.h.
    Location: Program Files\Microsoft Research KinectSDK\inc
  3. To use the Kinect Audio API, include MSRKinectAudio.h.
    Location: Program Files\Microsoft Research KinectSDK\inc
  4. Link to MSRKinectNUI.lib.
    Location: Program Files\Microsoft Research KinectSDK\lib
  5. Ensure that the beta SDK DLLs are on your path when you run your project.
    Location: \Program Files\Microsoft Research KinectSDK

I believe I've done everything apart from step 5. Could anyone give me more details on what this means and how to do this?

thanks in advance,
John

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迎风吟唱 2024-12-17 18:56:37

2.要使用 NUI API,请包含 MSR_NuiApi.h。位置:Program Files\Microsoft Research KinectSDK\inc

为此,您可能需要将该路径添加到项目中

  • 右键单击项目、属性、VC++ 目录
  • 添加 ;C:\Program Files\Microsoft Research KinectSDK\ inc 到包含路径的末尾
  • 添加 ;C:\Program Files\Microsoft Research KinectSDK\lib 到库路径的末尾

,然后添加

#include <MSR_NuiApi.h>

到源文件顶部的包含。如果您使用预编译头,那么您应该将其放在 stdafx.h 包含下方,或者只是将其添加到 stdafx.h 中。

5.确保运行项目时测试版 SDK DLL 位于您的路径上。位置:\Program Files\Microsoft Research KinectSDK

这意味着您的二进制文件需要能够在运行时找到这些文件。

最简单的方法是将它们添加到您的系统路径中;转到

  • 开始菜单
  • 右键单击计算机,属性
  • 高级系统设置
  • 环境变量
  • PATH,在您的用户或系统设置中 - 编辑并附加 ; 然后给定的路径

您可能需要重新启动 Visual Studio 才能选择此路径起,或者当您打开新的命令提示符时应该注册它。

或者,如果您不想更改系统设置,您可以将其添加到打开的命令提示符中

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

,或者您可以准确计算出需要哪些文件,并将它们复制到与二进制文件相同的目录中,等等。

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

To do this, you probably want to add that 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 include paths
  • Add ;C:\Program Files\Microsoft Research KinectSDK\lib to the end of the libraries paths

then add

#include <MSR_NuiApi.h>

to the includes at top of your source file. If you're using precompiled headers then you should put it below the stdafx.h include, or just add it to stdafx.h instead.

5.Ensure that the beta SDK DLLs are on your path when you run your project. Location: \Program Files\Microsoft Research KinectSDK

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

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

  • start menu
  • right-click computer, properties
  • advanced system settings
  • environment variables
  • PATH, in your user or system settings - edit and append ; then the path given

You may then need to restart Visual Studio to pick this up, or it should be registered when you open a new command prompt.

Or, if you don't want to change the system settings, you can e.g. add it to an open command prompt with

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

or you can work out exactly which files there are necessary and copy them into the same directory as your binary, etc.

水晶透心 2024-12-17 18:56:37

要实现 C++ 应用程序,

  1. 请首先在源代码中包含 windows.h。 (这一点很重要 - 您不能在项目中的任何位置定义 WIN32_LEAN_AND_MEAN,否则您将无法编译 NuiApi.h
  2. 包含 < code>在源代码中。

  3. 确保您为操作系统设置了反映 SDK 文件路径的环境变量。 SDK 安装应该会自动为您执行此操作。示例:

     KINECTSDK10_DIR = "C:\Program Files\Microsoft SDKs\Kinect\v1.0\"
    
  4. 转到 VC++ 目录下的 Visual Studio 项目设置。将 $(KINECTSDK10_DIR)\inc 添加到包含目录。

  5. 在同一 VC++ 目录区域下,包含 $(KINECTSDK10_DIR)\lib\x86 (对于 32 位应用程序)或 $(KINECTSDK10_DIR)\lib\amd64 (对于 64 位应用程序)在您的库目录中。

To implement a C++ application

  1. Include windows.h in your source code first. (This is important--you can't have WIN32_LEAN_AND_MEAN defined anywhere in your project or else you won't be able to compile NuiApi.h)

  2. Include <NuiApi.h> in your source code.

  3. Make sure you have an environment variable set up for your OS that reflects the SDK file path. The SDK installation should automatically do this for you. Example:

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

  5. Under the same VC++ directories area, include $(KINECTSDK10_DIR)\lib\x86 (for 32-bit apps) or $(KINECTSDK10_DIR)\lib\amd64 (for 64-bit apps) in your libraries directory.

糖果控 2024-12-17 18:56:37

我们使用的是 Kinect SDK 1.0 版,这就是项目的配置方式。请注意,开发人员计算机是 Windows 7 x86。如果您使用的是 x64,请相应更改路径。

第 1 步。复制头文件和库。这样做是有原因的:该项目可以签出到任何机器上并编译得很好(机器不必安装 SDK)。另一个好处是:我们将 SDK 升级到了 1.0 版本,但是因为我们的项目还没有更新,并且截止日期即将到来,所以我们必须使用 SDK 版本 beta 来构建它,一切都很顺利。

我建议您在解决方案中创建一个名为“3rdparty/KinectSDK”的新目录(更改它以满足您的需要)。

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

C:\Program Files\Microsoft SDKs\Kinect\v1.0\lib (您将同时具有 x86 和 x64 库)

第 2 步。配置项目。您需要为每个使用 Kinect SDK 的项目执行此操作!所有配置都在“项目属性”对话框中进行。

C/C++>一般>将“$(SolutionDir)\3rdparty\KinectSDK\inc”添加到您的“附加包含目录

链接器”>一般>将“$(SolutionDir)\3rdparty\KinectSDK\lib\x86”添加到您的其他库目录(如果您配置的是 x64,请使用 amd64 目录

)输入>将“Kinect10.lib”添加到其他依赖项

第 3 步。编译时间!

注意:

  • 如果您正确安装了 SDK,您的机器将能够运行/调试程序,而无需进一步配置。
  • 为了在客户端计算机上运行该程序,您需要复制 Kinect10.dll 文件。最好构建一个部署项目,DLL 会自动为您检测。
  • 对于客户端机器,您不需要为其安装SDK。只需获取驱动程序文件(.inf 等)并在插入 Kinect 时手动安装驱动程序即可。

祝你好运。

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

Step 1. Copy header files and library. There is a reason to do this: the project can be checked out to any machine and compile just fine (the machine doesn't have to install the SDK). Another benefit: we upgraded the SDK to version 1.0 but because our project hasn't been updated and the deadline is coming, we had to built it with SDK version beta and everything went smoothly.

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

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

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

Step 2. Configure the project. You will need to do this for each project that uses Kinect SDK! All configuration is happened in the Project Properties dialog.

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" to Additional Dependencies

Step 3. Compile time!

Note:

  • If you install the SDK correctly, your machine will be able to run / debug the program without further configuration.
  • In order to run the program in client machine, you will need to copy the Kinect10.dll file. It's best to build a deploy project, the DLL will be detected automatically for you.
  • Talking about client machine, you don't need to install SDK for it. Just grab the driver files (.inf and stuff) and install the driver manually when you plug in the Kinect.

Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文