pcl中的点云变换主要使用 transformPointCloud 函数。
可视化平台显示如下:
其中的使用klib插件平台,实现其中的插件算子:
struct TransOpMatrix4
{
Eigen::Matrix4f trans = Eigen::Matrix4f::Identity();
template<class PT>
KArbit operator()(const pcl::shared_ptr<PointCloud<PT> >& cld)
{
pcl::shared_ptr<PointCloud<PT>> transformed_cloud(new PointCloud<PT>);
pcl::transformPointCloud(*cld, *transformed_cloud, trans);
return transformed_cloud;
}
};
struct KPclTransCldMatrix4 : KPlugBase
{
TransOpMatrix4 p;
KPclTransCldMatrix4()
{
addProp("mat4x4").setType(PropTypeMat4x4).setValue(mat_identity(4,4)).setEmptyIndex(1);
}
int __exec(const KArbit& src, KArbit& dst) override
{
auto& aL = a2list(src);
CastType(trans, Eigen::Matrix4f, aL[1]);
p.trans = trans;
dst = cld_op(aL[0], p);
return true;
}
};