[#02] PCD νμΌ μ½κΈ°
PCD νμΌμ μ½μ΄λ³΄μ
νμΌ λ€μ΄λ‘λ
μ 체 μ½λ
#include <iostream>
// ν€λ νμΌ μ μΈ
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
using namespace std;
int main(int argc, char** argv)
{
// PCD νμΌμ λ΄μ Object μ μΈ
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>());
// 2κ°μ§ λ°©λ² μ‘΄μ¬
// 1. loadPCDFilie ν¨μλ₯Ό μ΄μ©
if (pcl::io::loadPCDFile("../before_proj.pcd", *cloud) == -1)
{
PCL_ERROR("Couldn't read the pcd file");
return -1;
}
// 2. PCDReaderλ₯Ό μ΄μ©
pcl::PCDReader reader;
reader.read("../before_proj.pcd", *cloud);
cout << "pc size: " << cloud->width * cloud->height << endl;
for(auto& point: *cloud)
{
cout << "x: " << point.x << " "
<< "y: " << point.y << " "
<< "z: " << point.z << endl;
}
return 0;
}
Leave a comment