Ask Your Question
0

Point Cloud Visualization Error.

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

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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

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

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 609 times

Last updated: May 01 '13