[#02] PCD ํ์ผ ์ฝ๊ธฐ
PCD ํ์ผ์ ์ฝ์ด๋ณด์
ํ์ผ ๋ค์ด๋ก๋
์ ์ฒด ์ฝ๋Permalink
#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