cv::Point3f 与pcl::PointXYZ初始化

时间:2021-06-07 19:54:23

对pcl::PointCloud <:pointxyz> 和std::vector <:point3f> v_point添加值

#include <opencv2/opencv.hpp>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

int main(int argc, char** argv)
{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
  std::vector<cv::Point3f> v_point;
  cloud->points.emplace_back(pcl::PointXYZ(1.0, 1.0, 1.0)); //first way
  cloud->push_back(pcl::PointXYZ(1.0, 1.0, 1.0)); //second way
  v_point.emplace_back(cv::Point3f(1.0, 1.0, 1.0));
  std::cout << "cloud size: " << cloud->size() << std::endl;
  std::cout << "v_point size: " << v_point.size() << std::endl;
  return 0;
}