OpenNIGrabber: performance problem ?

classic Classic list List threaded Threaded
58 messages Options
123
Reply | Threaded
Open this post in threaded view
|

OpenNIGrabber: performance problem ?

Benoît Penelle
Hereunder is a sample PCL-based code for displaying point clouds coming
from a Kinect. It runs, but the performance (frame rate) displayed in
the viewer is oscillating between 8 FPS and 12 FPS, which is far below
the frame rate offered by the Kinect (30 FPS). I've compiled the project
in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
it is so slow ?  My custom point cloud viewer runs at 30 FPS without any
problem on the same machine.

The second problem I observe, is that some frames are incomplete, making
the display flickering. I remember I had the same kind of problem with
the first version of OpenNI when using GetAlternativeViewPointCap() to
register color and depth image, but it has been solved with the lastest
version of OpenNI. Which version of OpenNI is used by PCL ?

Thanks,
Ben


#include <iostream>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/common/time.h>
#include <pcl/io/openni_grabber.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/cloud_viewer.h>

using namespace pcl;

class SimpleOpenNIProcessor
{
public:
     SimpleOpenNIProcessor()
     {
         m_viewer = new visualization::CloudViewer("Kinect Viewer");
     }

     ~SimpleOpenNIProcessor()
     {
         delete m_viewer;
     }

     void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr &cloud)
     {
         m_viewer->showCloud(cloud);
     }

     void run ()
     {
         // create a new grabber for OpenNI devices
         Grabber* interface = new OpenNIGrabber();

         // make callback function from member function
         boost::function<void (const
PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
(&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->registerCallback (f);

         // start receiving point clouds
         interface->start ();

         // wait until user quits program with Ctrl-C, but no
busy-waiting -> sleep (1);
         while (!m_viewer->wasStopped()) {}

         // stop the grabber
         interface->stop ();
     }

private:
     visualization::CloudViewer *m_viewer;

};

int main ()
{
     SimpleOpenNIProcessor v;
     v.run ();
}


_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Radu B. Rusu
Administrator
Ben,

Funny you should ask. Check this :)

large improvements in visualization performance, especially for streaming applications:

  large improvements in visualization performance, especially for streaming applications:
   * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@ in CloudViewer (public API addition)
   * no more @InsertNextCell@ in loops, which reallocates (private)
   * multiple @fromHandlersToScreen@ methods implemented (private API additions)
   * CloudActorMap is now a boost shared pointer, so that it's easily passable to the interactor style without any extra
copies (private API change)


http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174


I just pushed this in last night. The fix was trivial, and will be released in 1.1. If you're willing to try trunk, it
would mean a lot to us, cause we could get some educated feedback before the release. :) Thanks in advance!



Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 06/06/2011 02:18 AM, Benoît Penelle wrote:

> Hereunder is a sample PCL-based code for displaying point clouds coming
> from a Kinect. It runs, but the performance (frame rate) displayed in
> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
> the frame rate offered by the Kinect (30 FPS). I've compiled the project
> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
> it is so slow ?  My custom point cloud viewer runs at 30 FPS without any
> problem on the same machine.
>
> The second problem I observe, is that some frames are incomplete, making
> the display flickering. I remember I had the same kind of problem with
> the first version of OpenNI when using GetAlternativeViewPointCap() to
> register color and depth image, but it has been solved with the lastest
> version of OpenNI. Which version of OpenNI is used by PCL ?
>
> Thanks,
> Ben
>
>
> #include<iostream>
> #include<pcl/point_cloud.h>
> #include<pcl/point_types.h>
> #include<pcl/common/time.h>
> #include<pcl/io/openni_grabber.h>
> #include<pcl/io/pcd_io.h>
> #include<pcl/visualization/cloud_viewer.h>
>
> using namespace pcl;
>
> class SimpleOpenNIProcessor
> {
> public:
>       SimpleOpenNIProcessor()
>       {
>           m_viewer = new visualization::CloudViewer("Kinect Viewer");
>       }
>
>       ~SimpleOpenNIProcessor()
>       {
>           delete m_viewer;
>       }
>
>       void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>       {
>           m_viewer->showCloud(cloud);
>       }
>
>       void run ()
>       {
>           // create a new grabber for OpenNI devices
>           Grabber* interface = new OpenNIGrabber();
>
>           // make callback function from member function
>           boost::function<void (const
> PointCloud<PointXYZRGB>::ConstPtr&)>  f = boost::bind
> (&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->registerCallback (f);
>
>           // start receiving point clouds
>           interface->start ();
>
>           // wait until user quits program with Ctrl-C, but no
> busy-waiting ->  sleep (1);
>           while (!m_viewer->wasStopped()) {}
>
>           // stop the grabber
>           interface->stop ();
>       }
>
> private:
>       visualization::CloudViewer *m_viewer;
>
> };
>
> int main ()
> {
>       SimpleOpenNIProcessor v;
>       v.run ();
> }
>
>
> _______________________________________________
> [hidden email] / http://pointclouds.org
> https://code.ros.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Benoît Penelle
Hi Radu,

It's a lot better, indeed. Though, while the viewer is displaying frame
rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
that it's still significantly slower and not as smooth as with my custom
viewer (based on OpenNI) or other viewers I am using like the ones from
libfreenect.

On the other side, the flickering has disappeared, which is good news.

Thanks,
Ben

On 06/06/2011 05:29 PM, Radu B. Rusu wrote:

> Ben,
>
> Funny you should ask. Check this :)
>
> large improvements in visualization performance, especially for
> streaming applications:
>
>  large improvements in visualization performance, especially for
> streaming applications:
>   * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
> in CloudViewer (public API addition)
>   * no more @InsertNextCell@ in loops, which reallocates (private)
>   * multiple @fromHandlersToScreen@ methods implemented (private API
> additions)
>   * CloudActorMap is now a boost shared pointer, so that it's easily
> passable to the interactor style without any extra copies (private API
> change)
>
>
> http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174 
>
>
>
> I just pushed this in last night. The fix was trivial, and will be
> released in 1.1. If you're willing to try trunk, it would mean a lot
> to us, cause we could get some educated feedback before the release.
> :) Thanks in advance!
>
>
>
> Cheers,
> Radu.
> --
> Point Cloud Library (PCL) - http://pointclouds.org
>
> On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>> Hereunder is a sample PCL-based code for displaying point clouds coming
>> from a Kinect. It runs, but the performance (frame rate) displayed in
>> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
>> the frame rate offered by the Kinect (30 FPS). I've compiled the project
>> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
>> it is so slow ?  My custom point cloud viewer runs at 30 FPS without any
>> problem on the same machine.
>>
>> The second problem I observe, is that some frames are incomplete, making
>> the display flickering. I remember I had the same kind of problem with
>> the first version of OpenNI when using GetAlternativeViewPointCap() to
>> register color and depth image, but it has been solved with the lastest
>> version of OpenNI. Which version of OpenNI is used by PCL ?
>>
>> Thanks,
>> Ben
>>
>>
>> #include<iostream>
>> #include<pcl/point_cloud.h>
>> #include<pcl/point_types.h>
>> #include<pcl/common/time.h>
>> #include<pcl/io/openni_grabber.h>
>> #include<pcl/io/pcd_io.h>
>> #include<pcl/visualization/cloud_viewer.h>
>>
>> using namespace pcl;
>>
>> class SimpleOpenNIProcessor
>> {
>> public:
>>       SimpleOpenNIProcessor()
>>       {
>>           m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>       }
>>
>>       ~SimpleOpenNIProcessor()
>>       {
>>           delete m_viewer;
>>       }
>>
>>       void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>       {
>>           m_viewer->showCloud(cloud);
>>       }
>>
>>       void run ()
>>       {
>>           // create a new grabber for OpenNI devices
>>           Grabber* interface = new OpenNIGrabber();
>>
>>           // make callback function from member function
>>           boost::function<void (const
>> PointCloud<PointXYZRGB>::ConstPtr&)>  f = boost::bind
>> (&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->registerCallback
>> (f);
>>
>>           // start receiving point clouds
>>           interface->start ();
>>
>>           // wait until user quits program with Ctrl-C, but no
>> busy-waiting ->  sleep (1);
>>           while (!m_viewer->wasStopped()) {}
>>
>>           // stop the grabber
>>           interface->stop ();
>>       }
>>
>> private:
>>       visualization::CloudViewer *m_viewer;
>>
>> };
>>
>> int main ()
>> {
>>       SimpleOpenNIProcessor v;
>>       v.run ();
>> }
>>
>>
>> _______________________________________________
>> [hidden email] / http://pointclouds.org
>> https://code.ros.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Suat Gedikli
Hi,

are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?

Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate variation comes also from the synchronization. the streams do not have exactly the same framrate and during the synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.


Incomplete images: did you observe that in the viewer or directly with the images?
We had that problem, but that was solved looong time ago.

-Suat

2011/6/7 Benoît Penelle <[hidden email]>
Hi Radu,

It's a lot better, indeed. Though, while the viewer is displaying frame
rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
that it's still significantly slower and not as smooth as with my custom
viewer (based on OpenNI) or other viewers I am using like the ones from
libfreenect.

On the other side, the flickering has disappeared, which is good news.

Thanks,
Ben

On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
> Ben,
>
> Funny you should ask. Check this :)
>
> large improvements in visualization performance, especially for
> streaming applications:
>
>  large improvements in visualization performance, especially for
> streaming applications:
>   * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
> in CloudViewer (public API addition)
>   * no more @InsertNextCell@ in loops, which reallocates (private)
>   * multiple @fromHandlersToScreen@ methods implemented (private API
> additions)
>   * CloudActorMap is now a boost shared pointer, so that it's easily
> passable to the interactor style without any extra copies (private API
> change)
>
>
> http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
>
>
>
> I just pushed this in last night. The fix was trivial, and will be
> released in 1.1. If you're willing to try trunk, it would mean a lot
> to us, cause we could get some educated feedback before the release.
> :) Thanks in advance!
>
>
>
> Cheers,
> Radu.
> --
> Point Cloud Library (PCL) - http://pointclouds.org
>
> On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>> Hereunder is a sample PCL-based code for displaying point clouds coming
>> from a Kinect. It runs, but the performance (frame rate) displayed in
>> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
>> the frame rate offered by the Kinect (30 FPS). I've compiled the project
>> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
>> it is so slow ?  My custom point cloud viewer runs at 30 FPS without any
>> problem on the same machine.
>>
>> The second problem I observe, is that some frames are incomplete, making
>> the display flickering. I remember I had the same kind of problem with
>> the first version of OpenNI when using GetAlternativeViewPointCap() to
>> register color and depth image, but it has been solved with the lastest
>> version of OpenNI. Which version of OpenNI is used by PCL ?
>>
>> Thanks,
>> Ben
>>
>>
>> #include<iostream>
>> #include<pcl/point_cloud.h>
>> #include<pcl/point_types.h>
>> #include<pcl/common/time.h>
>> #include<pcl/io/openni_grabber.h>
>> #include<pcl/io/pcd_io.h>
>> #include<pcl/visualization/cloud_viewer.h>
>>
>> using namespace pcl;
>>
>> class SimpleOpenNIProcessor
>> {
>> public:
>>       SimpleOpenNIProcessor()
>>       {
>>           m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>       }
>>
>>       ~SimpleOpenNIProcessor()
>>       {
>>           delete m_viewer;
>>       }
>>
>>       void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>       {
>>           m_viewer->showCloud(cloud);
>>       }
>>
>>       void run ()
>>       {
>>           // create a new grabber for OpenNI devices
>>           Grabber* interface = new OpenNIGrabber();
>>
>>           // make callback function from member function
>>           boost::function<void (const
>> PointCloud<PointXYZRGB>::ConstPtr&)>  f = boost::bind
>> (&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->registerCallback
>> (f);
>>
>>           // start receiving point clouds
>>           interface->start ();
>>
>>           // wait until user quits program with Ctrl-C, but no
>> busy-waiting ->  sleep (1);
>>           while (!m_viewer->wasStopped()) {}
>>
>>           // stop the grabber
>>           interface->stop ();
>>       }
>>
>> private:
>>       visualization::CloudViewer *m_viewer;
>>
>> };
>>
>> int main ()
>> {
>>       SimpleOpenNIProcessor v;
>>       v.run ();
>> }
>>
>>
>> _______________________________________________
>> [hidden email] / http://pointclouds.org
>> https://code.ros.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Benoît Penelle
Hi,

I'm talking about what I see in the viewer : the displayed framerate, and the displayed point cloud. I don't know if it's the acquisition of the data or just the display that is too slowly updated, but the bottom line if that the simple example I've posted here under doesn't look good.

For the incomplete image, as I said in my last mail, the trunk version seems to solve it. I had the problem with the 1.0 release version.

Cheers,
Ben


On 06/07/2011 01:49 PM, Suat Gedikli wrote:
Hi,

are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?

Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate variation comes also from the synchronization. the streams do not have exactly the same framrate and during the synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.


Incomplete images: did you observe that in the viewer or directly with the images?
We had that problem, but that was solved looong time ago.

-Suat

2011/6/7 Benoît Penelle <[hidden email]>
Hi Radu,

It's a lot better, indeed. Though, while the viewer is displaying frame
rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
that it's still significantly slower and not as smooth as with my custom
viewer (based on OpenNI) or other viewers I am using like the ones from
libfreenect.

On the other side, the flickering has disappeared, which is good news.

Thanks,
Ben

On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
> Ben,
>
> Funny you should ask. Check this :)
>
> large improvements in visualization performance, especially for
> streaming applications:
>
>  large improvements in visualization performance, especially for
> streaming applications:
>   * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
> in CloudViewer (public API addition)
>   * no more @InsertNextCell@ in loops, which reallocates (private)
>   * multiple @fromHandlersToScreen@ methods implemented (private API
> additions)
>   * CloudActorMap is now a boost shared pointer, so that it's easily
> passable to the interactor style without any extra copies (private API
> change)
>
>
> http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
>
>
>
> I just pushed this in last night. The fix was trivial, and will be
> released in 1.1. If you're willing to try trunk, it would mean a lot
> to us, cause we could get some educated feedback before the release.
> :) Thanks in advance!
>
>
>
> Cheers,
> Radu.
> --
> Point Cloud Library (PCL) - http://pointclouds.org
>
> On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>> Hereunder is a sample PCL-based code for displaying point clouds coming
>> from a Kinect. It runs, but the performance (frame rate) displayed in
>> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
>> the frame rate offered by the Kinect (30 FPS). I've compiled the project
>> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
>> it is so slow ?  My custom point cloud viewer runs at 30 FPS without any
>> problem on the same machine.
>>
>> The second problem I observe, is that some frames are incomplete, making
>> the display flickering. I remember I had the same kind of problem with
>> the first version of OpenNI when using GetAlternativeViewPointCap() to
>> register color and depth image, but it has been solved with the lastest
>> version of OpenNI. Which version of OpenNI is used by PCL ?
>>
>> Thanks,
>> Ben
>>
>>
>> #include<iostream>
>> #include<pcl/point_cloud.h>
>> #include<pcl/point_types.h>
>> #include<pcl/common/time.h>
>> #include<pcl/io/openni_grabber.h>
>> #include<pcl/io/pcd_io.h>
>> #include<pcl/visualization/cloud_viewer.h>
>>
>> using namespace pcl;
>>
>> class SimpleOpenNIProcessor
>> {
>> public:
>>       SimpleOpenNIProcessor()
>>       {
>>           m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>       }
>>
>>       ~SimpleOpenNIProcessor()
>>       {
>>           delete m_viewer;
>>       }
>>
>>       void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>       {
>>           m_viewer->showCloud(cloud);
>>       }
>>
>>       void run ()
>>       {
>>           // create a new grabber for OpenNI devices
>>           Grabber* interface = new OpenNIGrabber();
>>
>>           // make callback function from member function
>>           boost::function<void (const
>> PointCloud<PointXYZRGB>::ConstPtr&)>  f = boost::bind
>> (&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->registerCallback
>> (f);
>>
>>           // start receiving point clouds
>>           interface->start ();
>>
>>           // wait until user quits program with Ctrl-C, but no
>> busy-waiting ->  sleep (1);
>>           while (!m_viewer->wasStopped()) {}
>>
>>           // stop the grabber
>>           interface->stop ();
>>       }
>>
>> private:
>>       visualization::CloudViewer *m_viewer;
>>
>> };
>>
>> int main ()
>> {
>>       SimpleOpenNIProcessor v;
>>       v.run ();
>> }
>>
>>
>> _______________________________________________
>> [hidden email] / http://pointclouds.org
>> https://code.ros.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users

_______________________________________________ [hidden email] / http://pointclouds.org https://code.ros.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Radu B. Rusu
Administrator
Benoit,

Thanks a lot. This is good feedback. I'll optimize the viewer even more today.

One question: can you please check the console and let us know what the callbacks say in terms of performance? For
example with openni_viewer, i get consistently 30fps (acquisition) and 30fps (drawing) on my crummy laptop :)

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 06/07/2011 06:40 AM, Benoît Penelle wrote:

> Hi,
>
> I'm talking about what I see in the viewer : the displayed framerate, and the displayed point cloud. I don't know if
> it's the acquisition of the data or just the display that is too slowly updated, but the bottom line if that the simple
> example I've posted here under doesn't look good.
>
> For the incomplete image, as I said in my last mail, the trunk version seems to solve it. I had the problem with the 1.0
> release version.
>
> Cheers,
> Ben
>
>
> On 06/07/2011 01:49 PM, Suat Gedikli wrote:
>> Hi,
>>
>> are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?
>>
>> Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate
>> variation comes also from the synchronization. the streams do not have exactly the same framrate and during the
>> synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.
>>
>>
>> Incomplete images: did you observe that in the viewer or directly with the images?
>> We had that problem, but that was solved looong time ago.
>>
>> -Suat
>>
>> 2011/6/7 Benoît Penelle <[hidden email] <mailto:[hidden email]>>
>>
>>     Hi Radu,
>>
>>     It's a lot better, indeed. Though, while the viewer is displaying frame
>>     rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
>>     that it's still significantly slower and not as smooth as with my custom
>>     viewer (based on OpenNI) or other viewers I am using like the ones from
>>     libfreenect.
>>
>>     On the other side, the flickering has disappeared, which is good news.
>>
>>     Thanks,
>>     Ben
>>
>>     On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
>>     > Ben,
>>     >
>>     > Funny you should ask. Check this :)
>>     >
>>     > large improvements in visualization performance, especially for
>>     > streaming applications:
>>     >
>>     > large improvements in visualization performance, especially for
>>     > streaming applications:
>>     > * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
>>     > in CloudViewer (public API addition)
>>     > * no more @InsertNextCell@ in loops, which reallocates (private)
>>     > * multiple @fromHandlersToScreen@ methods implemented (private API
>>     > additions)
>>     > * CloudActorMap is now a boost shared pointer, so that it's easily
>>     > passable to the interactor style without any extra copies (private API
>>     > change)
>>     >
>>     >
>>     > http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
>>     <http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174>
>>     >
>>     >
>>     >
>>     > I just pushed this in last night. The fix was trivial, and will be
>>     > released in 1.1. If you're willing to try trunk, it would mean a lot
>>     > to us, cause we could get some educated feedback before the release.
>>     > :) Thanks in advance!
>>     >
>>     >
>>     >
>>     > Cheers,
>>     > Radu.
>>     > --
>>     > Point Cloud Library (PCL) - http://pointclouds.org
>>     >
>>     > On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>>     >> Hereunder is a sample PCL-based code for displaying point clouds coming
>>     >> from a Kinect. It runs, but the performance (frame rate) displayed in
>>     >> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
>>     >> the frame rate offered by the Kinect (30 FPS). I've compiled the project
>>     >> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
>>     >> it is so slow ? My custom point cloud viewer runs at 30 FPS without any
>>     >> problem on the same machine.
>>     >>
>>     >> The second problem I observe, is that some frames are incomplete, making
>>     >> the display flickering. I remember I had the same kind of problem with
>>     >> the first version of OpenNI when using GetAlternativeViewPointCap() to
>>     >> register color and depth image, but it has been solved with the lastest
>>     >> version of OpenNI. Which version of OpenNI is used by PCL ?
>>     >>
>>     >> Thanks,
>>     >> Ben
>>     >>
>>     >>
>>     >> #include<iostream>
>>     >> #include<pcl/point_cloud.h>
>>     >> #include<pcl/point_types.h>
>>     >> #include<pcl/common/time.h>
>>     >> #include<pcl/io/openni_grabber.h>
>>     >> #include<pcl/io/pcd_io.h>
>>     >> #include<pcl/visualization/cloud_viewer.h>
>>     >>
>>     >> using namespace pcl;
>>     >>
>>     >> class SimpleOpenNIProcessor
>>     >> {
>>     >> public:
>>     >> SimpleOpenNIProcessor()
>>     >> {
>>     >> m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>     >> }
>>     >>
>>     >> ~SimpleOpenNIProcessor()
>>     >> {
>>     >> delete m_viewer;
>>     >> }
>>     >>
>>     >> void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>     >> {
>>     >> m_viewer->showCloud(cloud);
>>     >> }
>>     >>
>>     >> void run ()
>>     >> {
>>     >> // create a new grabber for OpenNI devices
>>     >> Grabber* interface = new OpenNIGrabber();
>>     >>
>>     >> // make callback function from member function
>>     >> boost::function<void (const
>>     >> PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
>>     >> (&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->registerCallback
>>     >> (f);
>>     >>
>>     >> // start receiving point clouds
>>     >> interface->start ();
>>     >>
>>     >> // wait until user quits program with Ctrl-C, but no
>>     >> busy-waiting -> sleep (1);
>>     >> while (!m_viewer->wasStopped()) {}
>>     >>
>>     >> // stop the grabber
>>     >> interface->stop ();
>>     >> }
>>     >>
>>     >> private:
>>     >> visualization::CloudViewer *m_viewer;
>>     >>
>>     >> };
>>     >>
>>     >> int main ()
>>     >> {
>>     >> SimpleOpenNIProcessor v;
>>     >> v.run ();
>>     >> }
>>     >>
>>     >>
>>     >> _______________________________________________
>>     >> [hidden email] <mailto:[hidden email]> / http://pointclouds.org
>>     >> https://code.ros.org/mailman/listinfo/pcl-users
>>     >
>>     _______________________________________________
>>     [hidden email] <mailto:[hidden email]> / http://pointclouds.org
>>     https://code.ros.org/mailman/listinfo/pcl-users
>>
>>
>>
>> _______________________________________________
>> [hidden email]  /http://pointclouds.org
>> https://code.ros.org/mailman/listinfo/pcl-users
>
>
> _______________________________________________
> [hidden email] / http://pointclouds.org
> https://code.ros.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Benoît Penelle
Radu,

Some clarifications :

1/ Until now, all the tests I've made were based on the piece of code show in my first mail and taken from the on-line tutorials. With this code, basically using the CloudViewer class and the showCloud method with a colored point cloud, I've tried PCL 1.0 and the trunk version of yesterday. The trunk solved the flickering (incomplete images), but the frame rate of the callback stays low : around 10 Hz. If I comment the showCloud line, I reach indeed the 30 Hz (but have no display ;-( ). This obviously indicates that it's the showCloud method that slows down the process.

2/ I've tried the openni_viewer tool and indeed, it reaches ~30Hz for the callback and ~25Hz for the display. Looking at the code, I deduce that it's better practice not to use CloudViewer, but rather the PCLVisualizer class with the addPointCloud and the updatePointCloud methods. BUT, openni_viewer works only for non-colored point clouds and when I try to modify the code to work with pcl::PointCloud<pcl::PointXYZRGB>, I got the following compilation errors :

openni_viewer.cpp:129:45: error: no matching function for call to ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&, const char [12])’

/usr/local/include/pcl-1.0/pcl/visualization/pcl_visualizer.h:269:9: note: candidate is: bool pcl::visualization::PCLVisualizer::addPointCloud(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&, const std::string&, int)


Cheers,
Ben

On 06/07/2011 06:01 PM, Radu B. Rusu wrote:
Benoit,

Thanks a lot. This is good feedback. I'll optimize the viewer even more today.

One question: can you please check the console and let us know what the callbacks say in terms of performance? For example with openni_viewer, i get consistently 30fps (acquisition) and 30fps (drawing) on my crummy laptop :)

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 06/07/2011 06:40 AM, Benoît Penelle wrote:
Hi,

I'm talking about what I see in the viewer : the displayed framerate, and the displayed point cloud. I don't know if
it's the acquisition of the data or just the display that is too slowly updated, but the bottom line if that the simple
example I've posted here under doesn't look good.

For the incomplete image, as I said in my last mail, the trunk version seems to solve it. I had the problem with the 1.0
release version.

Cheers,
Ben


On 06/07/2011 01:49 PM, Suat Gedikli wrote:
Hi,

are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?

Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate
variation comes also from the synchronization. the streams do not have exactly the same framrate and during the
synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.


Incomplete images: did you observe that in the viewer or directly with the images?
We had that problem, but that was solved looong time ago.

-Suat

2011/6/7 Benoît Penelle <[hidden email] [hidden email]>

    Hi Radu,

    It's a lot better, indeed. Though, while the viewer is displaying frame
    rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
    that it's still significantly slower and not as smooth as with my custom
    viewer (based on OpenNI) or other viewers I am using like the ones from
    libfreenect.

    On the other side, the flickering has disappeared, which is good news.

    Thanks,
    Ben

    On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
    > Ben,
    >
    > Funny you should ask. Check this :)
    >
    > large improvements in visualization performance, especially for
    > streaming applications:
    >
    > large improvements in visualization performance, especially for
    > streaming applications:
    > * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
    > in CloudViewer (public API addition)
    > * no more @InsertNextCell@ in loops, which reallocates (private)
    > * multiple @fromHandlersToScreen@ methods implemented (private API
    > additions)
    > * CloudActorMap is now a boost shared pointer, so that it's easily
    > passable to the interactor style without any extra copies (private API
    > change)
    >
    >
    > http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
    <http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174>
    >
    >
    >
    > I just pushed this in last night. The fix was trivial, and will be
    > released in 1.1. If you're willing to try trunk, it would mean a lot
    > to us, cause we could get some educated feedback before the release.
    > :) Thanks in advance!
    >
    >
    >
    > Cheers,
    > Radu.
    > --
    > Point Cloud Library (PCL) - http://pointclouds.org
    >
    > On 06/06/2011 02:18 AM, Benoît Penelle wrote:
    >> Hereunder is a sample PCL-based code for displaying point clouds coming
    >> from a Kinect. It runs, but the performance (frame rate) displayed in
    >> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
    >> the frame rate offered by the Kinect (30 FPS). I've compiled the project
    >> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
    >> it is so slow ? My custom point cloud viewer runs at 30 FPS without any
    >> problem on the same machine.
    >>
    >> The second problem I observe, is that some frames are incomplete, making
    >> the display flickering. I remember I had the same kind of problem with
    >> the first version of OpenNI when using GetAlternativeViewPointCap() to
    >> register color and depth image, but it has been solved with the lastest
    >> version of OpenNI. Which version of OpenNI is used by PCL ?
    >>
    >> Thanks,
    >> Ben
    >>
    >>
    >> #include<iostream>
    >> #include<pcl/point_cloud.h>
    >> #include<pcl/point_types.h>
    >> #include<pcl/common/time.h>
    >> #include<pcl/io/openni_grabber.h>
    >> #include<pcl/io/pcd_io.h>
    >> #include<pcl/visualization/cloud_viewer.h>
    >>
    >> using namespace pcl;
    >>
    >> class SimpleOpenNIProcessor
    >> {
    >> public:
    >> SimpleOpenNIProcessor()
    >> {
    >> m_viewer = new visualization::CloudViewer("Kinect Viewer");
    >> }
    >>
    >> ~SimpleOpenNIProcessor()
    >> {
    >> delete m_viewer;
    >> }
    >>
    >> void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
    >> {
    >> m_viewer->showCloud(cloud);
    >> }
    >>
    >> void run ()
    >> {
    >> // create a new grabber for OpenNI devices
    >> Grabber* interface = new OpenNIGrabber();
    >>
    >> // make callback function from member function
    >> boost::function<void (const
    >> PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
    >> (&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->registerCallback
    >> (f);
    >>
    >> // start receiving point clouds
    >> interface->start ();
    >>
    >> // wait until user quits program with Ctrl-C, but no
    >> busy-waiting -> sleep (1);
    >> while (!m_viewer->wasStopped()) {}
    >>
    >> // stop the grabber
    >> interface->stop ();
    >> }
    >>
    >> private:
    >> visualization::CloudViewer *m_viewer;
    >>
    >> };
    >>
    >> int main ()
    >> {
    >> SimpleOpenNIProcessor v;
    >> v.run ();
    >> }
    >>
    >>
    >> _______________________________________________
    >> [hidden email] [hidden email] / http://pointclouds.org
    >> https://code.ros.org/mailman/listinfo/pcl-users
    >
    _______________________________________________
    [hidden email] [hidden email] / http://pointclouds.org
    https://code.ros.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email]  /http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Benoît Penelle
Hello,

I've solved the compilation problem by modifying the openni_viewer code and using the template version of addPointCloud method. Now it compiles and runs, but when using pcl::PointXYZRGB, I still got a white on black display. Besides, the "drawing" framerate drops to 17Hz instead of 23Hz with pcl::PointXYZ.

PS: I'm using trunk version revision 1205 downloaded today.

Cheers,
Ben

On 06/08/2011 10:17 AM, Benoît Penelle wrote:
Radu,

Some clarifications :

1/ Until now, all the tests I've made were based on the piece of code show in my first mail and taken from the on-line tutorials. With this code, basically using the CloudViewer class and the showCloud method with a colored point cloud, I've tried PCL 1.0 and the trunk version of yesterday. The trunk solved the flickering (incomplete images), but the frame rate of the callback stays low : around 10 Hz. If I comment the showCloud line, I reach indeed the 30 Hz (but have no display ;-( ). This obviously indicates that it's the showCloud method that slows down the process.

2/ I've tried the openni_viewer tool and indeed, it reaches ~30Hz for the callback and ~25Hz for the display. Looking at the code, I deduce that it's better practice not to use CloudViewer, but rather the PCLVisualizer class with the addPointCloud and the updatePointCloud methods. BUT, openni_viewer works only for non-colored point clouds and when I try to modify the code to work with pcl::PointCloud<pcl::PointXYZRGB>, I got the following compilation errors :

openni_viewer.cpp:129:45: error: no matching
function for call to
‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&,
const char [12])’

/usr/local/include/pcl-1.0/pcl/visualization/pcl_visualizer.h:269:9:
note: candidate is: bool
pcl::visualization::PCLVisualizer::addPointCloud(const
pcl::PointCloud<pcl::PointXYZ>::ConstPtr&, const
std::string&, int)


Cheers,
Ben

On 06/07/2011 06:01 PM, Radu B. Rusu wrote:
Benoit,

Thanks a lot. This is good feedback. I'll optimize the viewer even more today.

One question: can you please check the console and let us know what the callbacks say in terms of performance? For example with openni_viewer, i get consistently 30fps (acquisition) and 30fps (drawing) on my crummy laptop :)

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 06/07/2011 06:40 AM, Benoît Penelle wrote:
Hi,

I'm talking about what I see in the viewer : the displayed framerate, and the displayed point cloud. I don't know if
it's the acquisition of the data or just the display that is too slowly updated, but the bottom line if that the simple
example I've posted here under doesn't look good.

For the incomplete image, as I said in my last mail, the trunk version seems to solve it. I had the problem with the 1.0
release version.

Cheers,
Ben


On 06/07/2011 01:49 PM, Suat Gedikli wrote:
Hi,

are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?

Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate
variation comes also from the synchronization. the streams do not have exactly the same framrate and during the
synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.


Incomplete images: did you observe that in the viewer or directly with the images?
We had that problem, but that was solved looong time ago.

-Suat

2011/6/7 Benoît Penelle <[hidden email] [hidden email]>

    Hi Radu,

    It's a lot better, indeed. Though, while the viewer is displaying frame
    rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
    that it's still significantly slower and not as smooth as with my custom
    viewer (based on OpenNI) or other viewers I am using like the ones from
    libfreenect.

    On the other side, the flickering has disappeared, which is good news.

    Thanks,
    Ben

    On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
    > Ben,
    >
    > Funny you should ask. Check this :)
    >
    > large improvements in visualization performance, especially for
    > streaming applications:
    >
    > large improvements in visualization performance, especially for
    > streaming applications:
    > * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
    > in CloudViewer (public API addition)
    > * no more @InsertNextCell@ in loops, which reallocates (private)
    > * multiple @fromHandlersToScreen@ methods implemented (private API
    > additions)
    > * CloudActorMap is now a boost shared pointer, so that it's easily
    > passable to the interactor style without any extra copies (private API
    > change)
    >
    >
    > http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
    <http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174>
    >
    >
    >
    > I just pushed this in last night. The fix was trivial, and will be
    > released in 1.1. If you're willing to try trunk, it would mean a lot
    > to us, cause we could get some educated feedback before the release.
    > :) Thanks in advance!
    >
    >
    >
    > Cheers,
    > Radu.
    > --
    > Point Cloud Library (PCL) - http://pointclouds.org
    >
    > On 06/06/2011 02:18 AM, Benoît Penelle wrote:
    >> Hereunder is a sample PCL-based code for displaying point clouds coming
    >> from a Kinect. It runs, but the performance (frame rate) displayed in
    >> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
    >> the frame rate offered by the Kinect (30 FPS). I've compiled the project
    >> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
    >> it is so slow ? My custom point cloud viewer runs at 30 FPS without any
    >> problem on the same machine.
    >>
    >> The second problem I observe, is that some frames are incomplete, making
    >> the display flickering. I remember I had the same kind of problem with
    >> the first version of OpenNI when using GetAlternativeViewPointCap() to
    >> register color and depth image, but it has been solved with the lastest
    >> version of OpenNI. Which version of OpenNI is used by PCL ?
    >>
    >> Thanks,
    >> Ben
    >>
    >>
    >> #include<iostream>
    >> #include<pcl/point_cloud.h>
    >> #include<pcl/point_types.h>
    >> #include<pcl/common/time.h>
    >> #include<pcl/io/openni_grabber.h>
    >> #include<pcl/io/pcd_io.h>
    >> #include<pcl/visualization/cloud_viewer.h>
    >>
    >> using namespace pcl;
    >>
    >> class SimpleOpenNIProcessor
    >> {
    >> public:
    >> SimpleOpenNIProcessor()
    >> {
    >> m_viewer = new visualization::CloudViewer("Kinect Viewer");
    >> }
    >>
    >> ~SimpleOpenNIProcessor()
    >> {
    >> delete m_viewer;
    >> }
    >>
    >> void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
    >> {
    >> m_viewer->showCloud(cloud);
    >> }
    >>
    >> void run ()
    >> {
    >> // create a new grabber for OpenNI devices
    >> Grabber* interface = new OpenNIGrabber();
    >>
    >> // make callback function from member function
    >> boost::function<void (const
    >> PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
    >> (&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->registerCallback
    >> (f);
    >>
    >> // start receiving point clouds
    >> interface->start ();
    >>
    >> // wait until user quits program with Ctrl-C, but no
    >> busy-waiting -> sleep (1);
    >> while (!m_viewer->wasStopped()) {}
    >>
    >> // stop the grabber
    >> interface->stop ();
    >> }
    >>
    >> private:
    >> visualization::CloudViewer *m_viewer;
    >>
    >> };
    >>
    >> int main ()
    >> {
    >> SimpleOpenNIProcessor v;
    >> v.run ();
    >> }
    >>
    >>
    >> _______________________________________________
    >> [hidden email] [hidden email] / http://pointclouds.org
    >> https://code.ros.org/mailman/listinfo/pcl-users
    >
    _______________________________________________
    [hidden email] [hidden email] / http://pointclouds.org
    https://code.ros.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email]  /http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users

_______________________________________________ [hidden email] / http://pointclouds.org https://code.ros.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Radu B. Rusu
Administrator
In reply to this post by Benoît Penelle
Benoit,

I made some more improvements in the visualization code in trunk/1.x. I get 30Hz consistently on my laptop now with
openni_viewer in XYZRGB mode.

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 06/08/2011 01:17 AM, Benoît Penelle wrote:

> Radu,
>
> Some clarifications :
>
> 1/ Until now, all the tests I've made were based on the piece of code show in my first mail and taken from the on-line
> tutorials. With this code, basically using the CloudViewer class and the showCloud method with a colored point cloud,
> I've tried PCL 1.0 and the trunk version of yesterday. The trunk solved the flickering (incomplete images), but the
> frame rate of the callback stays low : around 10 Hz. If I comment the showCloud line, I reach indeed the 30 Hz (but have
> no display ;-( ). This obviously indicates that it's the showCloud method that slows down the process.
>
> 2/ I've tried the openni_viewer tool and indeed, it reaches ~30Hz for the callback and ~25Hz for the display. Looking at
> the code, I deduce that it's better practice not to use CloudViewer, but rather the PCLVisualizer class with the
> addPointCloud and the updatePointCloud methods. BUT, openni_viewer works only for non-colored point clouds and when I
> try to modify the code to work with pcl::PointCloud<pcl::PointXYZRGB>, I got the following compilation errors :
>
> openni_viewer.cpp:129:45: error: no matching function for call to
> ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&, const char [12])’
>
> /usr/local/include/pcl-1.0/pcl/visualization/pcl_visualizer.h:269:9: note: candidate is: bool
> pcl::visualization::PCLVisualizer::addPointCloud(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&, const std::string&, int)
>
>
> Cheers,
> Ben
>
> On 06/07/2011 06:01 PM, Radu B. Rusu wrote:
>> Benoit,
>>
>> Thanks a lot. This is good feedback. I'll optimize the viewer even more today.
>>
>> One question: can you please check the console and let us know what the callbacks say in terms of performance? For
>> example with openni_viewer, i get consistently 30fps (acquisition) and 30fps (drawing) on my crummy laptop :)
>>
>> Cheers,
>> Radu.
>> --
>> Point Cloud Library (PCL) - http://pointclouds.org
>>
>> On 06/07/2011 06:40 AM, Benoît Penelle wrote:
>>> Hi,
>>>
>>> I'm talking about what I see in the viewer : the displayed framerate, and the displayed point cloud. I don't know if
>>> it's the acquisition of the data or just the display that is too slowly updated, but the bottom line if that the simple
>>> example I've posted here under doesn't look good.
>>>
>>> For the incomplete image, as I said in my last mail, the trunk version seems to solve it. I had the problem with the 1.0
>>> release version.
>>>
>>> Cheers,
>>> Ben
>>>
>>>
>>> On 06/07/2011 01:49 PM, Suat Gedikli wrote:
>>>> Hi,
>>>>
>>>> are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?
>>>>
>>>> Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate
>>>> variation comes also from the synchronization. the streams do not have exactly the same framrate and during the
>>>> synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.
>>>>
>>>>
>>>> Incomplete images: did you observe that in the viewer or directly with the images?
>>>> We had that problem, but that was solved looong time ago.
>>>>
>>>> -Suat
>>>>
>>>> 2011/6/7 Benoît Penelle <[hidden email] <mailto:[hidden email]>>
>>>>
>>>> Hi Radu,
>>>>
>>>> It's a lot better, indeed. Though, while the viewer is displaying frame
>>>> rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
>>>> that it's still significantly slower and not as smooth as with my custom
>>>> viewer (based on OpenNI) or other viewers I am using like the ones from
>>>> libfreenect.
>>>>
>>>> On the other side, the flickering has disappeared, which is good news.
>>>>
>>>> Thanks,
>>>> Ben
>>>>
>>>> On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
>>>> > Ben,
>>>> >
>>>> > Funny you should ask. Check this :)
>>>> >
>>>> > large improvements in visualization performance, especially for
>>>> > streaming applications:
>>>> >
>>>> > large improvements in visualization performance, especially for
>>>> > streaming applications:
>>>> > * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
>>>> > in CloudViewer (public API addition)
>>>> > * no more @InsertNextCell@ in loops, which reallocates (private)
>>>> > * multiple @fromHandlersToScreen@ methods implemented (private API
>>>> > additions)
>>>> > * CloudActorMap is now a boost shared pointer, so that it's easily
>>>> > passable to the interactor style without any extra copies (private API
>>>> > change)
>>>> >
>>>> >
>>>> > http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
>>>> <http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174>
>>>> >
>>>> >
>>>> >
>>>> > I just pushed this in last night. The fix was trivial, and will be
>>>> > released in 1.1. If you're willing to try trunk, it would mean a lot
>>>> > to us, cause we could get some educated feedback before the release.
>>>> > :) Thanks in advance!
>>>> >
>>>> >
>>>> >
>>>> > Cheers,
>>>> > Radu.
>>>> > --
>>>> > Point Cloud Library (PCL) - http://pointclouds.org
>>>> >
>>>> > On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>>>> >> Hereunder is a sample PCL-based code for displaying point clouds coming
>>>> >> from a Kinect. It runs, but the performance (frame rate) displayed in
>>>> >> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
>>>> >> the frame rate offered by the Kinect (30 FPS). I've compiled the project
>>>> >> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
>>>> >> it is so slow ? My custom point cloud viewer runs at 30 FPS without any
>>>> >> problem on the same machine.
>>>> >>
>>>> >> The second problem I observe, is that some frames are incomplete, making
>>>> >> the display flickering. I remember I had the same kind of problem with
>>>> >> the first version of OpenNI when using GetAlternativeViewPointCap() to
>>>> >> register color and depth image, but it has been solved with the lastest
>>>> >> version of OpenNI. Which version of OpenNI is used by PCL ?
>>>> >>
>>>> >> Thanks,
>>>> >> Ben
>>>> >>
>>>> >>
>>>> >> #include<iostream>
>>>> >> #include<pcl/point_cloud.h>
>>>> >> #include<pcl/point_types.h>
>>>> >> #include<pcl/common/time.h>
>>>> >> #include<pcl/io/openni_grabber.h>
>>>> >> #include<pcl/io/pcd_io.h>
>>>> >> #include<pcl/visualization/cloud_viewer.h>
>>>> >>
>>>> >> using namespace pcl;
>>>> >>
>>>> >> class SimpleOpenNIProcessor
>>>> >> {
>>>> >> public:
>>>> >> SimpleOpenNIProcessor()
>>>> >> {
>>>> >> m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>>> >> }
>>>> >>
>>>> >> ~SimpleOpenNIProcessor()
>>>> >> {
>>>> >> delete m_viewer;
>>>> >> }
>>>> >>
>>>> >> void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>>> >> {
>>>> >> m_viewer->showCloud(cloud);
>>>> >> }
>>>> >>
>>>> >> void run ()
>>>> >> {
>>>> >> // create a new grabber for OpenNI devices
>>>> >> Grabber* interface = new OpenNIGrabber();
>>>> >>
>>>> >> // make callback function from member function
>>>> >> boost::function<void (const
>>>> >> PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
>>>> >> (&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->registerCallback
>>>> >> (f);
>>>> >>
>>>> >> // start receiving point clouds
>>>> >> interface->start ();
>>>> >>
>>>> >> // wait until user quits program with Ctrl-C, but no
>>>> >> busy-waiting -> sleep (1);
>>>> >> while (!m_viewer->wasStopped()) {}
>>>> >>
>>>> >> // stop the grabber
>>>> >> interface->stop ();
>>>> >> }
>>>> >>
>>>> >> private:
>>>> >> visualization::CloudViewer *m_viewer;
>>>> >>
>>>> >> };
>>>> >>
>>>> >> int main ()
>>>> >> {
>>>> >> SimpleOpenNIProcessor v;
>>>> >> v.run ();
>>>> >> }
>>>> >>
>>>> >>
>>>> >> _______________________________________________
>>>> >> [hidden email] <mailto:[hidden email]> / http://pointclouds.org
>>>> >> https://code.ros.org/mailman/listinfo/pcl-users
>>>> >
>>>> _______________________________________________
>>>> [hidden email] <mailto:[hidden email]> / http://pointclouds.org
>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> [hidden email] /http://pointclouds.org
>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>
>>>
>>> _______________________________________________
>>> [hidden email] / http://pointclouds.org
>>> https://code.ros.org/mailman/listinfo/pcl-users
>>
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Benoît Penelle
Hi Radu,

I've tried it and it's great!  On my machine though it's not perfect, as
I get a drawing framerate that is a bit slower : between 19 and 22 Hz.

Thanks already for these changes,
Ben


On 06/12/2011 09:56 AM, Radu B. Rusu wrote:

> Benoit,
>
> I made some more improvements in the visualization code in trunk/1.x.
> I get 30Hz consistently on my laptop now with openni_viewer in XYZRGB
> mode.
>
> Cheers,
> Radu.
> --
> Point Cloud Library (PCL) - http://pointclouds.org
>
> On 06/08/2011 01:17 AM, Benoît Penelle wrote:
>> Radu,
>>
>> Some clarifications :
>>
>> 1/ Until now, all the tests I've made were based on the piece of code
>> show in my first mail and taken from the on-line
>> tutorials. With this code, basically using the CloudViewer class and
>> the showCloud method with a colored point cloud,
>> I've tried PCL 1.0 and the trunk version of yesterday. The trunk
>> solved the flickering (incomplete images), but the
>> frame rate of the callback stays low : around 10 Hz. If I comment the
>> showCloud line, I reach indeed the 30 Hz (but have
>> no display ;-( ). This obviously indicates that it's the showCloud
>> method that slows down the process.
>>
>> 2/ I've tried the openni_viewer tool and indeed, it reaches ~30Hz for
>> the callback and ~25Hz for the display. Looking at
>> the code, I deduce that it's better practice not to use CloudViewer,
>> but rather the PCLVisualizer class with the
>> addPointCloud and the updatePointCloud methods. BUT, openni_viewer
>> works only for non-colored point clouds and when I
>> try to modify the code to work with
>> pcl::PointCloud<pcl::PointXYZRGB>, I got the following compilation
>> errors :
>>
>> openni_viewer.cpp:129:45: error: no matching function for call to
>> ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&,
>> const char [12])’
>>
>> /usr/local/include/pcl-1.0/pcl/visualization/pcl_visualizer.h:269:9:
>> note: candidate is: bool
>> pcl::visualization::PCLVisualizer::addPointCloud(const
>> pcl::PointCloud<pcl::PointXYZ>::ConstPtr&, const std::string&, int)
>>
>>
>> Cheers,
>> Ben
>>
>> On 06/07/2011 06:01 PM, Radu B. Rusu wrote:
>>> Benoit,
>>>
>>> Thanks a lot. This is good feedback. I'll optimize the viewer even
>>> more today.
>>>
>>> One question: can you please check the console and let us know what
>>> the callbacks say in terms of performance? For
>>> example with openni_viewer, i get consistently 30fps (acquisition)
>>> and 30fps (drawing) on my crummy laptop :)
>>>
>>> Cheers,
>>> Radu.
>>> --
>>> Point Cloud Library (PCL) - http://pointclouds.org
>>>
>>> On 06/07/2011 06:40 AM, Benoît Penelle wrote:
>>>> Hi,
>>>>
>>>> I'm talking about what I see in the viewer : the displayed
>>>> framerate, and the displayed point cloud. I don't know if
>>>> it's the acquisition of the data or just the display that is too
>>>> slowly updated, but the bottom line if that the simple
>>>> example I've posted here under doesn't look good.
>>>>
>>>> For the incomplete image, as I said in my last mail, the trunk
>>>> version seems to solve it. I had the problem with the 1.0
>>>> release version.
>>>>
>>>> Cheers,
>>>> Ben
>>>>
>>>>
>>>> On 06/07/2011 01:49 PM, Suat Gedikli wrote:
>>>>> Hi,
>>>>>
>>>>> are you talking about the framerate for displaying the pointcloud
>>>>> or the framerate of receiving the pointcloud?
>>>>>
>>>>> Since, the viewer has nothing to do with the pointcloud assembly -
>>>>> they are in seperate threads. The frame-rate
>>>>> variation comes also from the synchronization. the streams do not
>>>>> have exactly the same framrate and during the
>>>>> synchronizer needs to wait for a closer frame to find
>>>>> corresponding rgb + depth images. Thus there is a small delay.
>>>>>
>>>>>
>>>>> Incomplete images: did you observe that in the viewer or directly
>>>>> with the images?
>>>>> We had that problem, but that was solved looong time ago.
>>>>>
>>>>> -Suat
>>>>>
>>>>> 2011/6/7 Benoît Penelle <[hidden email]
>>>>> <mailto:[hidden email]>>
>>>>>
>>>>> Hi Radu,
>>>>>
>>>>> It's a lot better, indeed. Though, while the viewer is displaying
>>>>> frame
>>>>> rates varying a lot in the range 20 to 50 FPS, my perceived
>>>>> sensation is
>>>>> that it's still significantly slower and not as smooth as with my
>>>>> custom
>>>>> viewer (based on OpenNI) or other viewers I am using like the ones
>>>>> from
>>>>> libfreenect.
>>>>>
>>>>> On the other side, the flickering has disappeared, which is good
>>>>> news.
>>>>>
>>>>> Thanks,
>>>>> Ben
>>>>>
>>>>> On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
>>>>> > Ben,
>>>>> >
>>>>> > Funny you should ask. Check this :)
>>>>> >
>>>>> > large improvements in visualization performance, especially for
>>>>> > streaming applications:
>>>>> >
>>>>> > large improvements in visualization performance, especially for
>>>>> > streaming applications:
>>>>> > * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
>>>>> > in CloudViewer (public API addition)
>>>>> > * no more @InsertNextCell@ in loops, which reallocates (private)
>>>>> > * multiple @fromHandlersToScreen@ methods implemented (private API
>>>>> > additions)
>>>>> > * CloudActorMap is now a boost shared pointer, so that it's easily
>>>>> > passable to the interactor style without any extra copies
>>>>> (private API
>>>>> > change)
>>>>> >
>>>>> >
>>>>> >
>>>>> http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
>>>>> <http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174>
>>>>>
>>>>> >
>>>>> >
>>>>> >
>>>>> > I just pushed this in last night. The fix was trivial, and will be
>>>>> > released in 1.1. If you're willing to try trunk, it would mean a
>>>>> lot
>>>>> > to us, cause we could get some educated feedback before the
>>>>> release.
>>>>> > :) Thanks in advance!
>>>>> >
>>>>> >
>>>>> >
>>>>> > Cheers,
>>>>> > Radu.
>>>>> > --
>>>>> > Point Cloud Library (PCL) - http://pointclouds.org
>>>>> >
>>>>> > On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>>>>> >> Hereunder is a sample PCL-based code for displaying point
>>>>> clouds coming
>>>>> >> from a Kinect. It runs, but the performance (frame rate)
>>>>> displayed in
>>>>> >> the viewer is oscillating between 8 FPS and 12 FPS, which is
>>>>> far below
>>>>> >> the frame rate offered by the Kinect (30 FPS). I've compiled
>>>>> the project
>>>>> >> in release mode on Ubuntu 11.04 64bits. Does any one have a
>>>>> clue on why
>>>>> >> it is so slow ? My custom point cloud viewer runs at 30 FPS
>>>>> without any
>>>>> >> problem on the same machine.
>>>>> >>
>>>>> >> The second problem I observe, is that some frames are
>>>>> incomplete, making
>>>>> >> the display flickering. I remember I had the same kind of
>>>>> problem with
>>>>> >> the first version of OpenNI when using
>>>>> GetAlternativeViewPointCap() to
>>>>> >> register color and depth image, but it has been solved with the
>>>>> lastest
>>>>> >> version of OpenNI. Which version of OpenNI is used by PCL ?
>>>>> >>
>>>>> >> Thanks,
>>>>> >> Ben
>>>>> >>
>>>>> >>
>>>>> >> #include<iostream>
>>>>> >> #include<pcl/point_cloud.h>
>>>>> >> #include<pcl/point_types.h>
>>>>> >> #include<pcl/common/time.h>
>>>>> >> #include<pcl/io/openni_grabber.h>
>>>>> >> #include<pcl/io/pcd_io.h>
>>>>> >> #include<pcl/visualization/cloud_viewer.h>
>>>>> >>
>>>>> >> using namespace pcl;
>>>>> >>
>>>>> >> class SimpleOpenNIProcessor
>>>>> >> {
>>>>> >> public:
>>>>> >> SimpleOpenNIProcessor()
>>>>> >> {
>>>>> >> m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>>>> >> }
>>>>> >>
>>>>> >> ~SimpleOpenNIProcessor()
>>>>> >> {
>>>>> >> delete m_viewer;
>>>>> >> }
>>>>> >>
>>>>> >> void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>>>> >> {
>>>>> >> m_viewer->showCloud(cloud);
>>>>> >> }
>>>>> >>
>>>>> >> void run ()
>>>>> >> {
>>>>> >> // create a new grabber for OpenNI devices
>>>>> >> Grabber* interface = new OpenNIGrabber();
>>>>> >>
>>>>> >> // make callback function from member function
>>>>> >> boost::function<void (const
>>>>> >> PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
>>>>> >> (&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->registerCallback
>>>>> >> (f);
>>>>> >>
>>>>> >> // start receiving point clouds
>>>>> >> interface->start ();
>>>>> >>
>>>>> >> // wait until user quits program with Ctrl-C, but no
>>>>> >> busy-waiting -> sleep (1);
>>>>> >> while (!m_viewer->wasStopped()) {}
>>>>> >>
>>>>> >> // stop the grabber
>>>>> >> interface->stop ();
>>>>> >> }
>>>>> >>
>>>>> >> private:
>>>>> >> visualization::CloudViewer *m_viewer;
>>>>> >>
>>>>> >> };
>>>>> >>
>>>>> >> int main ()
>>>>> >> {
>>>>> >> SimpleOpenNIProcessor v;
>>>>> >> v.run ();
>>>>> >> }
>>>>> >>
>>>>> >>
>>>>> >> _______________________________________________
>>>>> >> [hidden email] <mailto:[hidden email]> /
>>>>> http://pointclouds.org
>>>>> >> https://code.ros.org/mailman/listinfo/pcl-users
>>>>> >
>>>>> _______________________________________________
>>>>> [hidden email] <mailto:[hidden email]> /
>>>>> http://pointclouds.org
>>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> [hidden email] /http://pointclouds.org
>>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>>
>>>>
>>>> _______________________________________________
>>>> [hidden email] / http://pointclouds.org
>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>
>
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Radu B. Rusu
Administrator
Benoît,

Happy to hear that it works! I think there's still room for optimization, so I might take a second pass at it later next
week.

In the meantime, I am concentrating on writing a tutorial on how to optimize code using valgrind/kcachegrind, so that
others can learn and help us too! I've just optimized a few more classes today, and it feels pretty good to see those
FPS going up :) For example VoxelGrid now does 20Hz+ on my system, from 7Hz or less :)

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 06/14/2011 12:53 AM, Benoît Penelle wrote:

> Hi Radu,
>
> I've tried it and it's great! On my machine though it's not perfect, as I get a drawing framerate that is a bit slower :
> between 19 and 22 Hz.
>
> Thanks already for these changes,
> Ben
>
>
> On 06/12/2011 09:56 AM, Radu B. Rusu wrote:
>> Benoit,
>>
>> I made some more improvements in the visualization code in trunk/1.x. I get 30Hz consistently on my laptop now with
>> openni_viewer in XYZRGB mode.
>>
>> Cheers,
>> Radu.
>> --
>> Point Cloud Library (PCL) - http://pointclouds.org
>>
>> On 06/08/2011 01:17 AM, Benoît Penelle wrote:
>>> Radu,
>>>
>>> Some clarifications :
>>>
>>> 1/ Until now, all the tests I've made were based on the piece of code show in my first mail and taken from the on-line
>>> tutorials. With this code, basically using the CloudViewer class and the showCloud method with a colored point cloud,
>>> I've tried PCL 1.0 and the trunk version of yesterday. The trunk solved the flickering (incomplete images), but the
>>> frame rate of the callback stays low : around 10 Hz. If I comment the showCloud line, I reach indeed the 30 Hz (but have
>>> no display ;-( ). This obviously indicates that it's the showCloud method that slows down the process.
>>>
>>> 2/ I've tried the openni_viewer tool and indeed, it reaches ~30Hz for the callback and ~25Hz for the display. Looking at
>>> the code, I deduce that it's better practice not to use CloudViewer, but rather the PCLVisualizer class with the
>>> addPointCloud and the updatePointCloud methods. BUT, openni_viewer works only for non-colored point clouds and when I
>>> try to modify the code to work with pcl::PointCloud<pcl::PointXYZRGB>, I got the following compilation errors :
>>>
>>> openni_viewer.cpp:129:45: error: no matching function for call to
>>> ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&, const char [12])’
>>>
>>> /usr/local/include/pcl-1.0/pcl/visualization/pcl_visualizer.h:269:9: note: candidate is: bool
>>> pcl::visualization::PCLVisualizer::addPointCloud(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&, const std::string&,
>>> int)
>>>
>>>
>>> Cheers,
>>> Ben
>>>
>>> On 06/07/2011 06:01 PM, Radu B. Rusu wrote:
>>>> Benoit,
>>>>
>>>> Thanks a lot. This is good feedback. I'll optimize the viewer even more today.
>>>>
>>>> One question: can you please check the console and let us know what the callbacks say in terms of performance? For
>>>> example with openni_viewer, i get consistently 30fps (acquisition) and 30fps (drawing) on my crummy laptop :)
>>>>
>>>> Cheers,
>>>> Radu.
>>>> --
>>>> Point Cloud Library (PCL) - http://pointclouds.org
>>>>
>>>> On 06/07/2011 06:40 AM, Benoît Penelle wrote:
>>>>> Hi,
>>>>>
>>>>> I'm talking about what I see in the viewer : the displayed framerate, and the displayed point cloud. I don't know if
>>>>> it's the acquisition of the data or just the display that is too slowly updated, but the bottom line if that the
>>>>> simple
>>>>> example I've posted here under doesn't look good.
>>>>>
>>>>> For the incomplete image, as I said in my last mail, the trunk version seems to solve it. I had the problem with
>>>>> the 1.0
>>>>> release version.
>>>>>
>>>>> Cheers,
>>>>> Ben
>>>>>
>>>>>
>>>>> On 06/07/2011 01:49 PM, Suat Gedikli wrote:
>>>>>> Hi,
>>>>>>
>>>>>> are you talking about the framerate for displaying the pointcloud or the framerate of receiving the pointcloud?
>>>>>>
>>>>>> Since, the viewer has nothing to do with the pointcloud assembly - they are in seperate threads. The frame-rate
>>>>>> variation comes also from the synchronization. the streams do not have exactly the same framrate and during the
>>>>>> synchronizer needs to wait for a closer frame to find corresponding rgb + depth images. Thus there is a small delay.
>>>>>>
>>>>>>
>>>>>> Incomplete images: did you observe that in the viewer or directly with the images?
>>>>>> We had that problem, but that was solved looong time ago.
>>>>>>
>>>>>> -Suat
>>>>>>
>>>>>> 2011/6/7 Benoît Penelle <[hidden email] <mailto:[hidden email]>>
>>>>>>
>>>>>> Hi Radu,
>>>>>>
>>>>>> It's a lot better, indeed. Though, while the viewer is displaying frame
>>>>>> rates varying a lot in the range 20 to 50 FPS, my perceived sensation is
>>>>>> that it's still significantly slower and not as smooth as with my custom
>>>>>> viewer (based on OpenNI) or other viewers I am using like the ones from
>>>>>> libfreenect.
>>>>>>
>>>>>> On the other side, the flickering has disappeared, which is good news.
>>>>>>
>>>>>> Thanks,
>>>>>> Ben
>>>>>>
>>>>>> On 06/06/2011 05:29 PM, Radu B. Rusu wrote:
>>>>>> > Ben,
>>>>>> >
>>>>>> > Funny you should ask. Check this :)
>>>>>> >
>>>>>> > large improvements in visualization performance, especially for
>>>>>> > streaming applications:
>>>>>> >
>>>>>> > large improvements in visualization performance, especially for
>>>>>> > streaming applications:
>>>>>> > * replaced @removePointCloud/addPointCloud@ with @updatePointCloud@
>>>>>> > in CloudViewer (public API addition)
>>>>>> > * no more @InsertNextCell@ in loops, which reallocates (private)
>>>>>> > * multiple @fromHandlersToScreen@ methods implemented (private API
>>>>>> > additions)
>>>>>> > * CloudActorMap is now a boost shared pointer, so that it's easily
>>>>>> > passable to the interactor style without any extra copies (private API
>>>>>> > change)
>>>>>> >
>>>>>> >
>>>>>> > http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174
>>>>>> <http://dev.pointclouds.org/projects/pcl/repository/diff?rev=1175&rev_to=1174>
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > I just pushed this in last night. The fix was trivial, and will be
>>>>>> > released in 1.1. If you're willing to try trunk, it would mean a lot
>>>>>> > to us, cause we could get some educated feedback before the release.
>>>>>> > :) Thanks in advance!
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > Cheers,
>>>>>> > Radu.
>>>>>> > --
>>>>>> > Point Cloud Library (PCL) - http://pointclouds.org
>>>>>> >
>>>>>> > On 06/06/2011 02:18 AM, Benoît Penelle wrote:
>>>>>> >> Hereunder is a sample PCL-based code for displaying point clouds coming
>>>>>> >> from a Kinect. It runs, but the performance (frame rate) displayed in
>>>>>> >> the viewer is oscillating between 8 FPS and 12 FPS, which is far below
>>>>>> >> the frame rate offered by the Kinect (30 FPS). I've compiled the project
>>>>>> >> in release mode on Ubuntu 11.04 64bits. Does any one have a clue on why
>>>>>> >> it is so slow ? My custom point cloud viewer runs at 30 FPS without any
>>>>>> >> problem on the same machine.
>>>>>> >>
>>>>>> >> The second problem I observe, is that some frames are incomplete, making
>>>>>> >> the display flickering. I remember I had the same kind of problem with
>>>>>> >> the first version of OpenNI when using GetAlternativeViewPointCap() to
>>>>>> >> register color and depth image, but it has been solved with the lastest
>>>>>> >> version of OpenNI. Which version of OpenNI is used by PCL ?
>>>>>> >>
>>>>>> >> Thanks,
>>>>>> >> Ben
>>>>>> >>
>>>>>> >>
>>>>>> >> #include<iostream>
>>>>>> >> #include<pcl/point_cloud.h>
>>>>>> >> #include<pcl/point_types.h>
>>>>>> >> #include<pcl/common/time.h>
>>>>>> >> #include<pcl/io/openni_grabber.h>
>>>>>> >> #include<pcl/io/pcd_io.h>
>>>>>> >> #include<pcl/visualization/cloud_viewer.h>
>>>>>> >>
>>>>>> >> using namespace pcl;
>>>>>> >>
>>>>>> >> class SimpleOpenNIProcessor
>>>>>> >> {
>>>>>> >> public:
>>>>>> >> SimpleOpenNIProcessor()
>>>>>> >> {
>>>>>> >> m_viewer = new visualization::CloudViewer("Kinect Viewer");
>>>>>> >> }
>>>>>> >>
>>>>>> >> ~SimpleOpenNIProcessor()
>>>>>> >> {
>>>>>> >> delete m_viewer;
>>>>>> >> }
>>>>>> >>
>>>>>> >> void cloud_cb_ (const PointCloud<PointXYZRGB>::ConstPtr&cloud)
>>>>>> >> {
>>>>>> >> m_viewer->showCloud(cloud);
>>>>>> >> }
>>>>>> >>
>>>>>> >> void run ()
>>>>>> >> {
>>>>>> >> // create a new grabber for OpenNI devices
>>>>>> >> Grabber* interface = new OpenNIGrabber();
>>>>>> >>
>>>>>> >> // make callback function from member function
>>>>>> >> boost::function<void (const
>>>>>> >> PointCloud<PointXYZRGB>::ConstPtr&)> f = boost::bind
>>>>>> >> (&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->registerCallback
>>>>>> >> (f);
>>>>>> >>
>>>>>> >> // start receiving point clouds
>>>>>> >> interface->start ();
>>>>>> >>
>>>>>> >> // wait until user quits program with Ctrl-C, but no
>>>>>> >> busy-waiting -> sleep (1);
>>>>>> >> while (!m_viewer->wasStopped()) {}
>>>>>> >>
>>>>>> >> // stop the grabber
>>>>>> >> interface->stop ();
>>>>>> >> }
>>>>>> >>
>>>>>> >> private:
>>>>>> >> visualization::CloudViewer *m_viewer;
>>>>>> >>
>>>>>> >> };
>>>>>> >>
>>>>>> >> int main ()
>>>>>> >> {
>>>>>> >> SimpleOpenNIProcessor v;
>>>>>> >> v.run ();
>>>>>> >> }
>>>>>> >>
>>>>>> >>
>>>>>> >> _______________________________________________
>>>>>> >> [hidden email] <mailto:[hidden email]> / http://pointclouds.org
>>>>>> >> https://code.ros.org/mailman/listinfo/pcl-users
>>>>>> >
>>>>>> _______________________________________________
>>>>>> [hidden email] <mailto:[hidden email]> / http://pointclouds.org
>>>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> [hidden email] /http://pointclouds.org
>>>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> [hidden email] / http://pointclouds.org
>>>>> https://code.ros.org/mailman/listinfo/pcl-users
>>>>
>>
_______________________________________________
[hidden email] / http://pointclouds.org
https://code.ros.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Miguel Algaba
This post was updated on .
I'm experimenting similar issues with openni_viewer. I'm on Ubuntu 11.04 with the PCL trunk (downloaded on august 28). The drawing framerate is between 4~7 Hz and the callback between 10~15 Hz. I have set the CMAKE_BUILD_TYPE to "Release" using CMake GUI. Am I missing something?

Thanks a lot!



Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Jochen Sprickerhof
Administrator
Hi Miguel,

* Miguel Algaba <[hidden email]> [2011-09-05 06:48]:
> I'm experimenting similar issues with openni_viewer. I'm on Ubuntu 11.04 with
> the PCL trunk (downloaded on august 28). The drawing framerate is between
> 4~7 Hz and the callback between 10~15 Hz. I have set the CMAKE_BUILD_TYPE to
> "Release" using CMake GUI. Am I missing something?

I'm experiencing the same, will look into it now. Could you try
openni_grabber_example it's doing 30Hz for me.

> Thanks a lot!

Cheers,

Jochen
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Jochen Sprickerhof
Administrator
* Jochen Sprickerhof <[hidden email]> [2011-09-05 16:29]:

> Hi Miguel,
>
> * Miguel Algaba <[hidden email]> [2011-09-05 06:48]:
> > I'm experimenting similar issues with openni_viewer. I'm on Ubuntu 11.04 with
> > the PCL trunk (downloaded on august 28). The drawing framerate is between
> > 4~7 Hz and the callback between 10~15 Hz. I have set the CMAKE_BUILD_TYPE to
> > "Release" using CMake GUI. Am I missing something?
>
> I'm experiencing the same, will look into it now. Could you try
> openni_grabber_example it's doing 30Hz for me.

I've just checked again with todays trunk doing a clean build and got
30Hz, could you check that as well?

> > Thanks a lot!
>
> Cheers,
>
> Jochen
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
>
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Miguel Algaba
Thanks Jochen I will try it later because todays trunk doesn't compile for me.
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Miguel Algaba
Sorry I forgot to mention which compile error I have:

Linking CXX executable kinect_viewer_cuda
/home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL trunk/trunk/cuda/containers/src/initialization.cpp: In function ‘int pcl::gpu::getCudaEnabledDeviceCount()’:
/home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL trunk/trunk/cuda/containers/src/initialization.cpp:70:5: error: ‘___cudaSafeCall’ is not a member of ‘pcl::gpu’
/home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL trunk/trunk/cuda/containers/src/initialization.cpp: In function ‘void pcl::gpu::setDevice(int)’:
/home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL trunk/trunk/cuda/containers/src/initialization.cpp:76:5: error: ‘___cudaSafeCall’ is not a member of ‘pcl::gpu’
make[2]: *** [cuda/containers/CMakeFiles/pcl_gpu_containers.dir/src/initialization.cpp.o] Error 1
make[1]: *** [cuda/containers/CMakeFiles/pcl_gpu_containers.dir/all] Error 2
make[1]: *** Se espera a que terminen otras tareas....
[ 67%] Built target kinect_viewer_cuda
make: *** [all] Error 2
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Jochen Sprickerhof
Administrator
* Miguel Algaba <[hidden email]> [2011-09-06 02:07]:

> Sorry I forgot to mention which compile error I have:
>
> Linking CXX executable kinect_viewer_cuda
> /home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL
> trunk/trunk/cuda/containers/src/initialization.cpp: In function ‘int
> pcl::gpu::getCudaEnabledDeviceCount()’:
> /home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL
> trunk/trunk/cuda/containers/src/initialization.cpp:70:5: error:
> ‘___cudaSafeCall’ is not a member of ‘pcl::gpu’
> /home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL
> trunk/trunk/cuda/containers/src/initialization.cpp: In function ‘void
> pcl::gpu::setDevice(int)’:
> /home/miguel/Dropbox/PFC SLAM 3D/Libs/PCL/PCL
> trunk/trunk/cuda/containers/src/initialization.cpp:76:5: error:
> ‘___cudaSafeCall’ is not a member of ‘pcl::gpu’
> make[2]: ***
> [cuda/containers/CMakeFiles/pcl_gpu_containers.dir/src/initialization.cpp.o]
> Error 1
> make[1]: *** [cuda/containers/CMakeFiles/pcl_gpu_containers.dir/all] Error 2
> make[1]: *** Se espera a que terminen otras tareas....
> [ 67%] Built target kinect_viewer_cuda
> make: *** [all] Error 2

try disabling cuda, it is in flux right now.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Miguel Algaba
Jochen I have checked with todays trunk and openni_grabber_example works at ~30Hz, however openni_viewer is still working at ~15Hz (callback) and ~6Hz (visualization). Do you get ~30Hz with openni_viewer as well?

Thanks a lot!
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Jochen Sprickerhof
Administrator
* Miguel Algaba <[hidden email]> [2011-09-06 13:59]:
> Jochen I have checked with todays trunk and openni_grabber_example works at
> ~30Hz, however openni_viewer is still working at ~15Hz (callback) and ~6Hz
> (visualization). Do you get ~30Hz with openni_viewer as well?

It depends on the graphics card. I have tested a NVidia Quadro NVS 160M
and a ATI Radeon HD 3600 both using closed source drivers and got
similar results. On the other hand I've go 30Hz on a Sandy Bridge i7. I
guess there is something going wrong in VTK.

> Thanks a lot!

Cheers,

Jochen
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: OpenNIGrabber: performance problem ?

Miguel Algaba
Ok, thanks Jochen :)

2011/9/6 Jochen Sprickerhof [via Point Cloud Library (PCL) Users] <[hidden email]>
* Miguel Algaba <[hidden email]> [2011-09-06 13:59]:
> Jochen I have checked with todays trunk and openni_grabber_example works at
> ~30Hz, however openni_viewer is still working at ~15Hz (callback) and ~6Hz
> (visualization). Do you get ~30Hz with openni_viewer as well?

It depends on the graphics card. I have tested a NVidia Quadro NVS 160M
and a ATI Radeon HD 3600 both using closed source drivers and got
similar results. On the other hand I've go 30Hz on a Sandy Bridge i7. I
guess there is something going wrong in VTK.

> Thanks a lot!

Cheers,

Jochen
_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://www.pcl-users.org/OpenNIGrabber-performance-problem-tp3029172p3314857.html
To unsubscribe from OpenNIGrabber: performance problem ?, click here.

123