colored point cloud from asus xtion pro

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

colored point cloud from asus xtion pro

urvashi
I am trying to get the colored point cloud from the asus xtion pro using the basic code:

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

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

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

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

       boost::function<void (const pcl::PointCloud<pcl::PointXYZRGB>::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;
   v.run ();
   return 0;
 }    


but it throws the following error

terminate called after throwing an instance of 'pcl::IOException'
  what():  void pcl::OpenNIGrabber::setupDevice(const string&, const pcl::OpenNIGrabber::Mode&, const pcl::OpenNIGrabber::Mode&) in /build/buildd/pcl-1.7-1.7.2/io/src/openni_grabber.cpp @ 375 : No matching device found. openni_wrapper::OpenNIDevice::OpenNIDevice(xn::Context&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&) @ /build/buildd/pcl-1.7-1.7.2/io/src/openni_camera/openni_device.cpp @ 242 : creating depth generator failed. Reason: Got a timeout while waiting for a network command to complete!
Aborted (core dumped)


the code works fine for only XYZ point cloud.
I have installed the latest git version of openni. also tried different usb ports on my computer
does anyone have a solution for this?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: colored point cloud from asus xtion pro

Isabel
Hi,

Is the sensor pro live or just pro?, because the pro does not have rgb camera.

Cheers,

2017-07-17 3:28 GMT+02:00 urvashi <[hidden email]>:
I am trying to get the colored point cloud from the asus xtion pro using the
basic code:

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

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

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

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

       boost::function<void (const
pcl::PointCloud<pcl::PointXYZRGB>::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;
   v.run ();
   return 0;
 }


but it throws the following error

terminate called after throwing an instance of 'pcl::IOException'
  what():  void pcl::OpenNIGrabber::setupDevice(const string&, const
pcl::OpenNIGrabber::Mode&, const pcl::OpenNIGrabber::Mode&) in
/build/buildd/pcl-1.7-1.7.2/io/src/openni_grabber.cpp @ 375 : No matching
device found. openni_wrapper::OpenNIDevice::OpenNIDevice(xn::Context&, const
xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&) @
/build/buildd/pcl-1.7-1.7.2/io/src/openni_camera/openni_device.cpp @ 242 :
creating depth generator failed. Reason: Got a timeout while waiting for a
network command to complete!
Aborted (core dumped)


the code works fine for only XYZ point cloud.
I have installed the latest git version of openni. also tried different usb
ports on my computer
does anyone have a solution for this?



--
View this message in context: http://www.pcl-users.org/colored-point-cloud-from-asus-xtion-pro-tp4044790.html
Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



--
Isabel C. Patiño Mejía


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

Re: colored point cloud from asus xtion pro

urvashi
Hi Isabel, it's a pro live. I am getting the color as well as depth image using the openni viewer, but when i use the code above it does not work.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: colored point cloud from asus xtion pro

noname
if i remember correctly, there were two versions of the xtion pro live.
i've used them both and wondered why my stuff from the first project
didn't work on the second one. it turned out the second (newer) version
was incompatible with openni 1 (i.e. also the openni grabber
implementation and everything depending on it). hence, i had to
implement things using openni 2. (beware: i've also found some openni 2
grabber implementation in a "work in progress" branch on github or
something alike. it did not really work as well, but more because of a
faulty implementation i assume.)
not sure at all if it's of any relevance in your case, but maybe that
info helps. if you are using the openni viewer coming with the openni 2
installer, that might be a hint.


kind regards

On 17.07.2017 17:13, urvashi wrote:

> Hi Isabel, it's a pro live. I am getting the color as well as depth image
> using the openni viewer, but when i use the code above it does not work.
>
>
>
> --
> View this message in context: http://www.pcl-users.org/colored-point-cloud-from-asus-xtion-pro-tp4044790p4044796.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [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
|  
Report Content as Inappropriate

Re: colored point cloud from asus xtion pro

urvashi
Thanks. it did help me get more background on how this might work.. thanks a lot!

but the problem i am facing now is that the program doesnt go the callback at all!

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

     void cloud_cb_ (const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr &cloud)
     {
          pcl::PointCloud<pcl::PointXYZRGB> newcloud = *cloud;
          printf("%f", newcloud.size());
          printf("m here!!\n");
       if (!viewer.wasStopped())
         viewer.showCloud (cloud);
     }
};

void run ()
     {
       
       pcl::Grabber* interface = new pcl::OpenNIGrabber();
       boost::function<void (const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&)> f =
         boost::bind (&SimpleOpenNIViewer::cloud_cb_, this, _1);
       interface->registerCallback (f);
       while (!viewer.wasStopped())
       {
         boost::this_thread::sleep (boost::posix_time::seconds (1));
         //sleep(1);
       }
       interface->stop ();
     }
     pcl::visualization::CloudViewer viewer;
 };

 int main ()
 {
   SimpleOpenNIViewer v;
   v.run ();
   return 0;
 }

it works fine when i make it an XYZ point cloud. any help would be appreciated!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: colored point cloud from asus xtion pro

urvashi
got it working finally!
i somehow missed using openni2grabber. so I replaced openni_grabber.h with openni2_grabber.h and pcl:opennigrabber() with pcl::io::openni2grabber() and it worked!! Yayy!
Loading...