c++ - PCL How to create a Point Cloud array/vector? -


i have stored 85 point clouds on hdd. want open clouds , save them in vector/array.
how should this?

what tested no success:

    define _crt_secure_no_warnings     #include <pcl/io/pcd_io.h>     #include <pcl/point_types.h>     #include <pcl/registration/icp.h>     #include <pcl/visualization/pcl_visualizer.h>     #include <pcl/common/transforms.h>     #include <pcl/filters/voxel_grid.h>     #include <pcl/filters/radius_outlier_removal.h>      #include <eigen/geometry>       #include <iostream>     #include <string>      using namespace pcl;     using namespace std;      int main(int argc, char** argv)     {     //create point clouds     pointcloud<pointxyz>::ptr sourcecloud(new pointcloud<pointxyz>);      vector < pointcloud<pointxyz>::ptr, eigen::aligned_allocator <pointcloud <pointxyz>::ptr > > sourceclouds;      //save pointclouds array     (int = 1; < (argc - 1); i++)     {         if (io::loadpcdfile<pointxyz>(argv[i], *sourcecloud) != 0)         {             return -1;         }         cout << "loaded file " << argv[i] << " (" << sourcecloud->size() << " points)" << endl;         sourceclouds.push_back(sourcecloud);         cout << "point cloud " << i-1 << "has got " << sourceclouds[i-1]->size() << " points" << endl;         sourcecloud->clear();     }      (int = 0; < sourceclouds.size() - 1; i++)     {         cout << "point cloud " << << "has got " << sourceclouds[i]->size() << " points" << endl;     }     } 

in first loop, pointcloudsize both clouuds same, in second loop, pointcloudsize 0.
i'am doing wrong?

sourceclouds.push_back(sourcecloud); 

this line copy pointcloud::ptr , not copy point cloud data.

try this:

  int main(int argc, char** argv)     {     //create point clouds     //pointcloud<pointxyz>::ptr sourcecloud(new pointcloud<pointxyz>);      vector < pointcloud<pointxyz>::ptr, eigen::aligned_allocator <pointcloud <pointxyz>::ptr > > sourceclouds;      //save pointclouds array     (int = 1; < (argc - 1); i++)     {         pointcloud<pointxyz>::ptr sourcecloud(new pointcloud<pointxyz>);         if (io::loadpcdfile<pointxyz>(argv[i], *sourcecloud) != 0)         {             return -1;         }         cout << "loaded file " << argv[i] << " (" << sourcecloud->size() << " points)" << endl;         sourceclouds.push_back(sourcecloud);         cout << "point cloud " << i-1 << "has got " << sourceclouds[i-1]->size() << " points" << endl;        // sourcecloud->clear();     }      (int = 0; < sourceclouds.size() - 1; i++)     {         cout << "point cloud " << << "has got " << sourceclouds[i]->size() << " points" << endl;     }     } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -