How I got openni_grabber to work using only pcl and openni binaries

My Machine Specs:

- 2015 15" MBP

- Intel i7 (8 x64 cores)

- Ubuntu 14.04.4 x84

- AMD Radeon R9 M370X

- Kinect 360 via USB2 plug from Amazon. You may have to go through a USB2 hub to get it to work (slower).

Here's what I installed:

- ROS Indigo

- $ sudo apt-get install ros-indigo-openni*
- $ sudo apt-get install ros-indigo-freenect*

- follow "Linux" install instructions for SensorKinect


I prefer the openni_grabber example from because the points are in all white. Their example is a bit broken by default so here is a working example of the code:


cmake_minimum_required(VERSION 2.8 FATAL_ERROR)


find_package(PCL 1.2 REQUIRED)


add_executable (openni_grabber openni_grabber.cpp)
target_link_libraries (openni_grabber ${PCL_LIBRARIES})


 #include <pcl/io/openni_grabber.h> 
 #include <pcl/visualization/cloud_viewer.h> 

 class SimpleOpenNIViewer
     SimpleOpenNIViewer () : viewer ("PCL OpenNI Viewer") {}

     void cloud_cb_ (const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &cloud)
       if (!viewer.wasStopped())
         viewer.showCloud (cloud);

     void run ()
       pcl::Grabber* interface = new pcl::OpenNIGrabber();

       boost::function<void (const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&)> f =
         boost::bind (&SimpleOpenNIViewer::cloud_cb_, this, _1);

       interface->registerCallback (f);

       interface->start ();

       while (!viewer.wasStopped())
         boost::this_thread::sleep (boost::posix_time::seconds (1));

       interface->stop ();

     pcl::visualization::CloudViewer viewer;

 int main ()
   SimpleOpenNIViewer v; ();
   return 0;

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.

More information about formatting options

Complete this form and then pat yourself on the back.