c++ - 不期望将 .ply 文件转换为 .pcd 文件
问题描述
我正在将 .ply 文件转换为 .pcd 文件。我的 .ply 文件的标题如下:
ply
format binary_little_endian 1.0
element vertex 63194
property float x
property float y
property float z
property uchar blue
property uchar green
property uchar red
property uchar alpha
end_header
输出数据如下:
VERSION 0.7VERSION 0.7
FIELDS x y z rgba
SIZE 4 4 4 4
TYPE F F F U
COUNT 1 1 1 1
WIDTH 63194
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 63194
DATA ascii
-7734.2715 8366.3252 -2.1842694 0
-7734.5063 8366.3125 -1.9932992 0
-7733.0181 8366.3887 -2.20522 0
-7733.2417 8366.376 -2.0148311 0
-7731.7578 8366.4414 -2.2282174 0
我发现所有的 agba 都是 0,但是我找不到决定 rgba 值的代码。
所以我的问题是我怎样才能得到正确的 rgba?这是我的测试代码
bool loadCloud (const std::string &filename, pcl::PCLPointCloud2 &cloud)
{
pcl::PLYReader reader;
if (reader.read (filename, cloud) < 0)
return (false);
return (true);
}
void saveCloud (const std::string &filename, const pcl::PCLPointCloud2 &cloud, bool format)
{
pcl::PCDWriter writer;
writer.write (filename, cloud, Eigen::Vector4f::Zero (), Eigen::Quaternionf::Identity (), format);
}
int main (int argc, char** argv)
{
pcl::PCLPointCloud2 cloud;
if (!loadCloud ("input.ply", cloud))
return (-1);
saveCloud ("output.pcd", cloud, false);
return (0);
}
解决方案
推荐阅读
- r - 在 Shiny 中保存对不同数据表的更改
- python - 仅当列中的NaN少于给定数量时,如何用列替换NaN?
- tomcat - 从单个 webapps 文件夹将两个 war 文件部署到不同的端口
- java - 从文件中读取文本行
- swift - SwiftUI 点击手势识别器仅在影响状态更改时调用一次
- python - 用特定术语替换单元格
- node.js - Mongoose 连接到身份验证数据库语法以包括 auth 和 useNewUrlParser 选项
- c# - 使用 Delegate.CreateDelegate 将可变参数函数转换为 System.Action
- asp.net - 无法加载文件或程序集“System.Runtime.InteropServices.RuntimeInformation”
- excel - 测试 VBA rnd 函数的随机性