PCL Custom Point Type 사용

Sangil Choi·2022년 11월 2일

PCL

목록 보기
1/1

소스코드 맨 위에 define 추가

// myPCL.cpp
#define PCL_NO_PRECOMPILE
...
#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
...

Custom Point Type 구조체 정의 및 등록

struct MyPointType
{
	PCL_ADD_POINT4D;
    uint16_t reflectivity;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;

POINT_CLOUD_REGISTER_POINT_STRUCT (MyPointType,
								  (float, x, x)
                                  (float, y, y)
                                  (float, z, z)
                                  (uint16_t, reflectivity, reflectivity)
)

Custom Point Type 사용

pcl::PointCloud<MyPointType>::Ptr cloud (new pcl::PointCloud<MyPointType>());
pcl::PointCloud<MyPointType>::Ptr cloud_passed (new pcl::PointCloud<MyPointType>);

pcl::PassThrough<MyPointType> pass;
pass.setInputCloud(cloud);
pass.setFilterFieldName("x");
pass.setFilterLimits(0.0, 20.0);
pass.filter(*cloud_passed);

Downsampling issue

pcl::VoxelGrid를 사용하여 다운샘플링을 하면 좌표(x,y,z)외의 데이터는 유실된다.

profile
return true

0개의 댓글