PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.98k stars 4.62k forks source link

pcl_ply2pcd in pcl 1.8.0 #1945

Closed Wyllich closed 7 years ago

Wyllich commented 7 years ago

Hello,

I decided to use the pcl 1.8.0 release As a previous user of the 1.7.2 version, I was quite surprised to face an issue using ply2pcd as I never encountered such problem. I applied ply2pcd on ply files which worked previously but received the same error:

pcl_ply2pcd: /home/usr/pcl-pcl-1.8.0/io/src/ply_io.cpp:500: void pcl::PLYReader::objInfoCallback(const string&): Assertion 'st.size() == 3' failed.
>Loading output.ply Aborted (core dumped)

Does anyone one you using the 1.8.0 version test the ply2pcd function?

Update : Tested on a XYZ ply file and it worked. As my ply file contains XYZ Reflectance Label Class, some properties may not be handled by the newer version.

SergioRAgostinho commented 7 years ago

Does anyone one you using the 1.8.0 version test the ply2pcd function?

We have two files filed with unit test which employ the PLYReader. If you feel that something is missing you're more than welcome to file a PR extending the tests.

From what I remember we only changed behavior in what concerns color parsing.

What exactly is a XYZ Reflectance label class?

Wyllich commented 7 years ago

This is the ply header :

ply
format binary_big_endian 1.0
comment CMM-ARMINES: MorphoViewer3D - PLY File
obj_info Points and polygons
element vertex 10000000
property float32 x
property float32 y
property float32 z
property float32 reflectance
property uint label
property uint class
end_header

Label is an arbitrary number given to an object and class is a number which tells in which category the object falls (car, pedestrian, lightpoles...)

Is is a problem with this type of file (I looked for similar issues but none of the solutions was useful to me) or my pcl build?

PS: http://cmm.ensmp.fr/~serna/rueMadameDataset.html in case anyone is willing to try to use those ply files.

SergioRAgostinho commented 7 years ago

It's not that there's a problem with your file, syntactically-wise, but the thing is that we only parse properties which have a direct mapping to our point types.

If you read the comment on our header file ply_io.h, it states the following

/** \brief Point Cloud Data (PLY) file format reader.
    *
    * The PLY data format is organized in the following way:
    * lines beginning with "comment" are treated as comments
    *   - ply
    *   - format [ascii|binary_little_endian|binary_big_endian] 1.0
    *   - element vertex COUNT
    *   - property float x 
    *   - property float y 
    *   - [property float z] 
    *   - [property float normal_x] 
    *   - [property float normal_y] 
    *   - [property float normal_z] 
    *   - [property uchar red] 
    *   - [property uchar green] 
    *   - [property uchar blue] ...
    *   - ascii/binary point coordinates
    *   - [element camera 1]
    *   - [property float view_px] ...
    *   - [element range_grid COUNT]
    *   - [property list uchar int vertex_indices]
    *   - end header
    *
    * \author Nizar Sallem
    * \ingroup io

Which means we are not currently parsing fields other than the ones specified.

Now what I find surprising is your statement that somehow this was working with pcl 1.7.2. What exactly was working?

SergioRAgostinho commented 7 years ago

Goes without saying, we're open to extend the functionality but he will probably need to discuss what's the best way to approach it.

Wyllich commented 7 years ago

I went through my old coding and this may explain how I was able to convert some ply files.

Before recompiling, I was able to load from the same data into a PointXYZL (label) cloud from the ply file and save them into a pcd file. Somehow, loadPLYFile simply ignores the unknown properties and does not block at any time.

SergioRAgostinho commented 7 years ago

That should be the behaviour yes. But from the error message you posted it seems there's really an error in parsing. The algorithm seems to be looking for something which is supposed to be of size 3 and it's not.

The second other thing to note is that this is an assertion. They only trigger when you compile code in debug mode. If by any chance your 1.7.2 was compiled in release mode you also wouldn't see it. The same reasoning can be applied to the version you're using now. Nevertheless you can assume parsing is having problems.

Wyllich commented 7 years ago

pcl_ply2pcd seems to work this morning. The problem disappeared. I will report here if I ever find out what fixed it.

SergioRAgostinho commented 7 years ago

Reopen if needed.