PCL - Point Cloud Library

You might want to look at the nestk library. I found it today. It allows you to interface with PCL.


going to give this a shot - hit me up if you have tried or have any insights

seems the tricky part is going to get all the dependencies to 32 bit versions

i’ve gotten it to compile in OSX and ubuntu. it was much easier on ubuntu. the main problem i had was that once it was compiled, the demos weren’t working at all on OSX. and i was running ubuntu in a VM so the graphics acceleration might have been crashing it there.

that was a few months ago. they’re moving really fast. good luck!

ok - I think I have most things down to 32 bit and started to bring them into OF

I am using the nestk route for now. I am hung up on this error:

/usr/include/c++/4.2.1/ctime:68:0 /usr/include/c++/4.2.1/ctime:68: error: '::tm' has not been declared  

From my searching it seems that this is caused by ntk having a class named time.h. It is however in a ntk namespace so I am thinking I need some sort of XCode flag set or forward declaration trick or possibly a framework added in order for it to use the correct one?

 In file included from /usr/include/c++/4.2.1/cwchar:52,  
                 from /usr/include/c++/4.2.1/bits/postypes.h:46,  
                 from /usr/include/c++/4.2.1/iosfwd:49,  
                 from /usr/include/c++/4.2.1/bits/stl_algobase.h:70,  
                 from /usr/include/c++/4.2.1/algorithm:65,  
                 from addons/ofxOpenCv/libs/opencv/include/opencv2/core/core.hpp:56,  
                 from addons/ofxOpenCv/libs/opencv/include/opencv/cxcore.h:51,  
                 from addons/ofxNestk/include/ntk/core.h:25,  
                 from /Volumes/WORK_IN_PROGRESS/OPENFRAMEWORKS/007/openFrameworks/apps/jvcApps/NestkTest/addons/ofxNestk/include/ntk/utils/time.h:23,  
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:26,  
                 from /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:20,  
                 from /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,  
                 from /System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,  
                 from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20:  
/usr/include/c++/4.2.1/ctime:68: error: '::tm' has not been declared  
/usr/include/c++/4.2.1/ctime:70: error: '::clock' has not been declared  
/usr/include/c++/4.2.1/ctime:71: error: '::difftime' has not been declared  
/usr/include/c++/4.2.1/ctime:72: error: '::mktime' has not been declared  
/usr/include/c++/4.2.1/ctime:73: error: '::time' has not been declared  
/usr/include/c++/4.2.1/ctime:74: error: '::asctime' has not been declared  
/usr/include/c++/4.2.1/ctime:75: error: '::ctime' has not been declared  
/usr/include/c++/4.2.1/ctime:76: error: '::gmtime' has not been declared  
/usr/include/c++/4.2.1/ctime:77: error: '::localtime' has not been declared  
/usr/include/c++/4.2.1/ctime:78: error: '::strftime' has not been declared  

I would post the project but I still have a lot of dependencies that are on my system

I still don’t try nestk, I’d like to do so, maybe this weekend and see how it goes.

As for PCL I gave up, at least making it work with the kinect and trying to compile its examples.
I really don’t remember which errors the compilation threw, it was some time ago, but I can see that theres a new version of PCL and that the kinect issues were fixed.

I’ll post any improvements.


I am using libfreenect drivers with C language on linux platform.My task is to find x,y,z coordinates of the markers placed on a human body joints which will be detected by kinect sensors i.e x,y coordinates from rgb camera of kinect and z from depth sensor of kinect.Can any one tell me how to use pcl library for finding out x,y,z coordinates of markers with opencv and Point cloud library.Waiting for your urgent help.
Thanks in advance.

Hi, do you really need markers? I assume that this is for doing MoCap.
Because otherwise try OpenNI, and you will get automatically the joint coordinates.
On the other hand, PCL is not designed to track markers.
You can do everything you need with OpenCV, from capturing the kinect rgb and depth data, to tracking the markers. Make sure you enable the registervieport method so the rgb and depth images coincide.
For tracking infrared illumination should work better, and using infrared reflective markers.

Good luck with it!

BTW, for everyone else.

Yesterday I compiled PCL 1.2 on my mac, in fact there are some really neat instructions for doing so, but I was unable to capture data from the kinect with the demos provided.
When running them, after doing the usual OpenNI inicialization the program crashed with a segmentation fault.
The strange thing is that on PCL’s site it says that you need to install a patched version of OpenNI and the Primesense driver, that were buid from version 1.1 which is quite old. Maybe that is generating the problems.
I’ll insist on it later this week and let you know how it goes.

Yes I am doing Mocap but i dont want markers.Actually i have already used opencv algorithm to detect and track markers and that is done.My next step is to extract the x,y,z coordinates of the moving markers for which i think we can use PCL library and opencv but i dont know what functions will be used to extract x,y from rgb and z from depth.Or can u tel me any other way to find x,y,z coordinates rather than pcl library.Moreover,can u elaborate what is register viewport and how to do it with libfreenect. Actually,i am very new to opencv, computer vision and kinect so i need your help.

as your question drifts away from the focus of this thread I moved it here.


I appear to have PCL 1-2 compiled and working in OF. Fingers crossed I have all the dependencies/libraries included to where they will work on another machine.

You can follow on github:

Here is the project that I have currently working:

Warning - it is pretty massive - around 900MB. about 140MB

Downloading it right now.
Did yo try using the kinect with your compilation of PCL?


I haven’t

update: Got the openni stuff compiling/running. As PCL 1-2 has a hardcoded path for macs you currently have to copy





I did that.
And it compiles, starts running an initializing the OpenNI modules but at some point it crashes.
Have you encountered any problems of that kind?
Besides, in the openNI site it says that a modified OpenNI and Primesens libs should be installed so PCL can run with the Kinect. Did you install these mod’d libs or did you use a newer version.
I ask becaause I tryed it with the OpenNI provided libs and with the newest OpenNI libs.
In both cases it failed to work.

So far I haven’t been able to test what you posted before. I’d beed ultra busy.


@roymacdonald can you post your console output when it crashes?

I am using this without openni installed on the system. I am actually using gameoverhack’s ofxOpenNI openni libs from his experimental branch. I did mod these with the change_exec_paths script so PCL correctly sourced them at runtime.

had a typo in previous post SampleConfig.xml should be SamplesConfig.xml

This is a really interesting project. I’m writing a library for primitive shape detection in point clouds, and PCL is the obvious approach. Got it compiling and running in oF, but the kinect data is handled with some middleware methods I wrote to map ofxopenni data to pcl::pointcloud. It works, but I want to use pcl::opennigrabber.

So far, everything compiles fine, but I hit this in the console:

Init lib_usb control of Kinect Motor, LEDs and accelerometersCreating OpenNIDevice
Open failed: File not found!
node depth problems
node image problems
node ir problems

Any idea what file it’s looking for (think only XnOS.h throws that)? Can’t find any reference in the debugger. I do have SamplesConfig.xml in the right spot, as per http://pointclouds.org/documentation/tutorials/compiling-pcl-macosx.php#compiling-pcl-macosx

Got it to work. My console looks like this now (using http://pointclouds.org/documentation/tutorials/openni-grabber.php sample):

Init lib_usb control of Kinect Motor, LEDs and accelerometersCreating OpenNIDevice
Warning: USB events thread - failed to set priority. This might cause loss of data…
node ir problems
distance of center pixel :1.777 mm. Average framerate: 17.747 Hz
distance of center pixel :1.795 mm. Average framerate: 18.174 Hz
distance of center pixel :1.814 mm. Average framerate: 17.2978 Hz
distance of center pixel :0.511 mm. Average framerate: 17.0666 Hz
distance of center pixel :0.49 mm. Average framerate: 19.1783 Hz
distance of center pixel :0.486 mm. Average framerate: 17.5537 Hz
distance of center pixel :0.513 mm. Average framerate: 18.0526 Hz
distance of center pixel :0.561 mm. Average framerate: 17.9862 Hz

I needed to upgrade my libusb and openni libraries as per http://pointclouds.org/downloads/macosx.html I think the modified openni libs are essential, but I’ll dig around some more to make sure.

Since the release of PCL 1.4.0 I gave this another shot on a clean system that is working with the latest OpenNI/Kinect. This time I went the route of installing OpenNI on the system as opposed to trying to use self-contained libs

It’s a bit of a mess and I would like to get it into a separate project that is included (like the OF project) but is currently working with the openGrabber Example