title: How to use PCL to filter point cloud data from kinect
body: <p>I am now working with PCL and kinect, the call back function is shown below:</p>
  
  <p>I want to do some filtering but I can't access "cloud" in the callback function directly because it is constant type, so I copy it to "cloud2" to see if it works.</p>
  
  <p>The result is compiling pass but run time error, any one help me?</p>
  
  <pre><code>class SimpleOpenNIProcessor
  {
  public:
      pcl::PointCloud&lt;pcl::PointXYZ&gt;::Ptr cloud2;
       SimpleOpenNIProcessor () : viewer ("PCL OpenNI Viewer") {}
       void cloud_cb_ (const pcl::PointCloud&lt;pcl::PointXYZ&gt;::ConstPtr &amp;cloud)
    {
  
      *(cloud2)=*(cloud);
       if (!viewer.wasStopped())
           viewer.showCloud (cloud);
  
    }
  
    void run ()
    {
  
      // create a new grabber for OpenNI devices
      pcl::Grabber* interface = new pcl::OpenNIGrabber();
  
      // make callback function from member function
      boost::function&lt;void (const pcl::PointCloud&lt;pcl::PointXYZ&gt;::ConstPtr&amp;)&gt; f =
        boost::bind (&amp;SimpleOpenNIProcessor::cloud_cb_, this, _1);
  
      // connect callback function for desired signal. In this case its a point cloud with color values
      boost::signals2::connection c = interface-&gt;registerCallback (f);
  
      // start receiving point clouds
      interface-&gt;start ();
  
      // wait until user quits program with Ctrl-C, but no busy-waiting -&gt; sleep (1);
      while (true)
        sleep(1);
  
      // stop the grabber
      interface-&gt;stop ();
    }
        pcl::visualization::CloudViewer viewer;
  
  };
  
  int main ()
  {
  
    SimpleOpenNIProcessor v;
    v.run ();
    return (0);
  }
  </code></pre>