I have a .ply file and the header is
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
...
...
Then I write a C++/PCL
code as the following:
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)
...
...
}
Then I get the result
Failed to find match for field 'red'.
Failed to find match for field 'green.
Failed to find match for field 'blue'.
It is really really wired because I can read all other fields except the RGB!
In addition, if I change the field name or type in the file(as well as the code), I can read it, but obviously, I don’t want to modify the file one by one.
Looking for your help~
You can find the code and .ply here drive