我有一个 .ply 文件,标题是
ply
format ascii 1.0
element vertex 131072
property float x
property float y
property float z
property float intensity
property uint t
property ushort reflectivity
property uchar ring
property ushort noise
property uint range
property uchar label
property uchar red
property uchar green
property uchar blue
end_header
0 -0 0 7 0 0 0 384 0 0 0 0 0
...
...
然后我编写C++/PCL
如下代码:
struct OusterPointS {
PCL_ADD_POINT4D;
float intensity;
std::uint32_t t;
std::uint16_t reflectivity;
std::uint8_t ring;
std::uint16_t noise;
std::uint32_t range;
std::uint8_t label;
std::uint8_t red;
std::uint8_t green;
std::uint8_t blue;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;
POINT_CLOUD_REGISTER_POINT_STRUCT(OusterPointS,
(float, x, x)(float, y, y)(float, z, z)(float, intensity, intensity)
(std::uint32_t, t, t)(std::uint16_t, reflectivity, reflectivity)
(std::uint8_t, ring, ring)(std::uint16_t, noise, noise)(std::uint32_t, range, range)(std::uint8_t, label, label)
(std::uint8_t, red, red)(std::uint8_t, green, green)(std::uint8_t, blue, blue)
)
int main() {
...
...
pcl::PointCloud<OusterPointS>::Ptr os_cloud(new pcl::PointCloud<OusterPointS>);
pcl::io::loadPLYFile(os_path, *os_cloud)
...
...
}
然后我得到结果
找不到字段“红色”的匹配项。
找不到字段“绿色”的匹配项。
找不到字段“蓝色”的匹配项。
它真的很连线,因为我可以读取除 RGB 之外的所有其他字段!
另外,如果我更改文件的字段名称或类型(以及代码),我可以阅读它,但显然,我不想一一修改文件。
寻求您的帮助~
您可以在此处找到代码和 .ply驱动器