Unable to display simple point cloud

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

Unable to display simple point cloud

Lucas
I have problems to display a pointcloud. I compiled the PCL sucessfully and can build and run my own projects, but when I try to display pointclouds the output seems strange.
 I will see the same output no matter which pointcloud I am trying to display. I am new to PCL and I am not exactly sure how my output is supposed to look like. Any ideas what is going on? I based my test code on this PCL tutorial. I am running the code in debug mode in Visual Studio 2012 and I get no compile/link errors or warnings.
This is my test code (but the results are the same when I load other point clouds from a file):

#include <iostream>

#include <pcl/visualization/cloud_viewer.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int main(int argc, char* argv[])
{
        pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>);

   // Fill in the cloud data
  cloud->width    = 50;
  cloud->height   = 50;
  cloud->is_dense = false;
  cloud->points.resize (cloud->width * cloud->height);

  for (size_t i = 0; i < cloud->points.size (); ++i)
  {
    cloud->points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud->points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    cloud->points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
  }

  pcl::visualization::CloudViewer viewer("Simple Cloud Viewer");
  viewer.showCloud(cloud);
  while(!viewer.wasStopped()){
  }
  return 0;
}

Reply | Threaded
Open this post in threaded view
|

Re: Unable to display simple point cloud

Sergey
Administrator
Hi Lucas,

Use the wheel of your mouse to zoom out, because what is displayed on your screenshot is a very close view of the spot where the three axes of the coordinate system meet.

Regards,
Sergey