参考以下几个网站:
http://stackoverflow.com/questions/14644191/openni-2-and-visual-studio-2012 这个最有用了
http://blog.youkuaiyun.com/chenxin_130/article/details/8580636
以及heresy的网站http://viml.nchc.org.tw/blog/paper_info.php?CLASS_ID=1&SUB_ID=1&PAPER_ID=425
pre: 下载 kinect for windows sdk 并安装
1、下载openni2:
http://ishare.iask.sina.com.cn/f/37059734.html
在官网上下载一直有问题,下不下来。找了半天找到了这个资源。
2、安装:
step1:
点击安装,完成Openni2的安装(这个没什么好说的)
step2:配置vs2012
第一部分:
- Create a new C++ Win32 Console Application Project
- Go to Project>MyProject Properties and, in Configuration Properties>VC++ Directories...
- Added C:\Program Files (x86)\OpenNI2\Redist\; to Executable Directories
- Added C:\Program Files (x86)\OpenNI2\Include\; to Include Directories
- Added C:\Program Files (x86)\OpenNI2\Redist\; to Reference Directories
- Added C:\Program Files (x86)\OpenNI2\Lib\; to Library Directories
0-In the C/C++ section, under the "General" node, select
"Additional Include Directories"
and add
C:\Program Files (x86)\OpenNI2\Include)
1-In the Linker section, under the "General" node, select
"Additional Library Directories"
and add
C:\Program Files (x86)\OpenNI2\Lib)
2-In the Linker section, under the input node, select
"Additional Dependencies"
and add
OpenNI2.lib
第三部分:(重要!)
在进行以上配置之后,我的程序可以运行。但是程序中openni2检测不到任何的设备!
我运行NiViewer是没有问题的,所以肯定是配置出了问题。
花了一晚上终于搞定了,原来是没有拷贝\OpenNI2\Redist目录下文件到程序执行目录。