After trying long way to capture Point Cloud without Grabber, there is easier way to capture Point Cloud with Kinect. Utilize OpenNI2 Grabber.But here, make sure you add additional Property Sheet for OpenNI2
C/C++ Additional Include Dir
Linker Additional Library Dir
Make Sure OpenNI is set in the Environment Variables
OPENNI2_INCLUDE64 -> Folder location of Include folder
OPENNI2_LIB64 -> Folder location of Library folder
OPENNI2_REDIST64 -> Folder location of OpenNI Redist folder OpenNI2\Redist
above setting are in the System Variables of Environment Variables. And add also value %OPENNI2_REDIST64%; in the Path Variables.
If we have done with config above, mostly we can avoid error related to external library dependencies.
Please refer to reference below for the Source Code. The original tutorial from PCL website (ref no 2 and 3) is the old OpenNI version 1 which is not supported anymore, especially with VS2015. Moreover we use OpenNI2 now (ref no 1). There He provided us with Kinect2_grabber.h. Or if you do not want to use that header, we still can use only PCL header.
The only difference is the location of OpenNIGrabber method.
Code used in OpenNI version 1
pcl::Grabber* interface = new pcl::OpenNIGrabber(); boost::function::ConstPtr&)> f = boost::bind (&SimpleOpenNIViewer::cloud_cb_, this, _1); interface->registerCallback (f); interface->start ();
You will not find
new pcl::OpenNIGrabber() in Open NI2 library. So change that code with
do not forget that the header also different in PCL 1.8 for OpenNI2 , the header is
Only some differences.
But for me, I used reference no 1 since it was easier. sometimes OpenNI2 driver didn’t installed properly, like my case, I still have trouble using OpenNI2
If you found some error, please refer to my previous posting here
1.PCL::IOException (updated soon when I solved it)