Ask Your Question

How to convert vector<Point3f> in pcl

asked 2017-08-03 02:17:48 -0500

snehal gravatar image


I have 3d points of vector<point3f> type, and i want convert it into pcl::PointCloud<pcl::pointxyz> type for visualization of 3d points. How can i convert these vector type points , can anyone suggest me?

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-08-03 03:49:00 -0500

berak gravatar image

updated 2017-08-03 03:51:45 -0500

you'll have to copy the points manually:

  vector<Point3f> pts = ...;
  pcl::PointCloud<pcl::PointXYZ> cloud;
  cloud.points.resize (pts.size());
   for (size_t i=0; i<pts3d.size(); i++) {
         cloud.points[i].x = pts[i].x;
         cloud.points[i].y = pts[i].y;
         cloud.points[i].z = pts[i].z;
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-08-03 02:17:48 -0500

Seen: 1,066 times

Last updated: Aug 03 '17