ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Point Cloud Visualization Error.

asked 2013-05-01 22:03:20 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am trying to visualize point cloud, but it gave error like error C2664: 'void pcl::visualization::CloudViewer::showCloud(const boost::shared_ptr<t> &,const std::string &)' : cannot convert parameter 1 from 'pcl::PointCloud<pointt>' to 'const boost::shared_ptr<t> &'. Thanks in advance.

Here is my sample code:

#include <iostream>

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

int main (int argc, char** argv) 
{ 
  pcl::PointCloud<pcl::PointXYZ> cloud; 

  // Fill in the cloud data 
  cloud.width    = 5; 
  cloud.height   = 1; 
  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); 
}
edit retag flag offensive close merge delete

Comments

Thnx. It works fine.

Nihad gravatar image Nihad  ( 2013-05-02 01:40:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
5

answered 2013-05-02 01:16:40 -0600

Try "viewer.showCloud(cloud.makeShared());"

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-01 22:03:20 -0600

Seen: 727 times

Last updated: May 01 '13