Capture Point Cloud with PCL 1.8 and Kinect V2 #3 – OpenNI2 Grabber

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

OpenNI2.props

C/C++ Additional Include Dir

C:\Program Files\OpenNI2\Include

Linker Additional Library Dir

C:\Program Files\OpenNI2\Lib;

Linker Input

OpenNI2.lib

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 new pcl::io::OpenNI2Grabber()
do not forget that the header also different in PCL 1.8 for OpenNI2 , the header is #include <pcl\io\openni2_grabber.h>

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

References: 1 | 2 | 3 |

Error Troubleshooting:

1.PCL::IOException (updated soon when I solved it)

3 thoughts on “Capture Point Cloud with PCL 1.8 and Kinect V2 #3 – OpenNI2 Grabber

  1. Ender

    Hi, first of all, thank you very much for this tutorial. It helped me very much.

    Unfortunately, I still have an error I cannot solve. I’m trying to use OpenNI2 but i’m getting an error in runtime everytime I execute the following:

    pcl::Grabber* interface = new pcl::io::OpenNI2Grabber();

    The error says “pcl::IOException at memory location 0x0000002044BBED38”

    Do you know why this happens?

    Thank you very much

    1. ninan

      is it working without grabber? if the error only found with grabber…
      hmm im not sure either about the problem. i was trying to search your problem through google and found some people got the similar error. some of them solve it with reinstaling and testing with other apps.
      if you cannot find the solution, try to post it at PCL forum. write your system also. because the developing environmnt can be different

Leave a Reply

Your email address will not be published. Required fields are marked *