Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLY reader can't parse header correctly #2763

Closed
msy22 opened this issue Jan 8, 2019 · 4 comments
Closed

PLY reader can't parse header correctly #2763

msy22 opened this issue Jan 8, 2019 · 4 comments

Comments

@msy22
Copy link

msy22 commented Jan 8, 2019

The PCL ply reader often fails to read some point clouds, for a reason I haven't been able to pin down yet. The error message suggests the header is at fault, and yet it will load clouds with a virtually identical header just fine.

Your Environment

  • Operating System and version: Ubuntu 14.04
  • Compiler: GCC v4.8.4
  • PCL Version: 1.8.1
  • C++ Version: C++11

Context

I'm trying to load a variety of point clouds for testing other problems within PCL (see this github issue). However the ply reader occasionally refuses to read the header, and normally I've been able to resolve the issue by just loading the file in cloud compare and saving it again with less information (i.e. but saving without colour or intensity info). But now its failing to read even a basic .ply file.

It WILL load this cloud: bunny.ply with the following header:

ply
format ascii 1.0
comment Author: CloudCompare (TELECOM PARISTECH/EDF R&D)
obj_info Generated by CloudCompare!
element vertex 21552
property float x
property float y
property float z
end_header

But it will NOT load this cloud: carpark_rear.ply with this header:

ply
format ascii 1.0
comment Author: CloudCompare (TELECOM PARISTECH/EDF R&D)
obj_info Generated by CloudCompare!
element vertex 58491
property float x
property float y
property float z
end_header

Expected Behavior

I expect the reader to load every ply with an appropriate header

Current Behavior

It fails to load the carpark cloud and produces this error:

[pcl::PLYReader] /home/matt/point_cloud_data/Clouds_for_debugging_precision_issues/ODS_carpark_rear_a.ply:1: parse error: couldn't read the magic string
[pcl::PLYReader::read] problem parsing header!
[pcl::PLYReader::read] problem parsing header!

Code to Reproduce

These are the two lines of code I'm using:

pcl::PLYReader reader;
reader.read(file_name, *cloud);

Possible Solution

The error message is being generated by this line in ply_parser.cpp so I think it has something to do with istream failing to read the first line of the file - ply. However from what I can tell there aren't any hidden characters at the end of this line... so I'm not sure why this is failing.

@msy22
Copy link
Author

msy22 commented Jan 8, 2019

Found the issue, minor spelling mistake in my file name.

For reference, error messages like this are terribly uninformative and misleading. Plyreader should output an error to the effect of "Unable to find file with that name", rather than "unable to read header" which implies that the reader was able to find and open the file, but not read it.

@taketwo
Copy link
Member

taketwo commented Jan 10, 2019

Sorry for the trouble, good point. I've started an issue so that this is not lost.

@msy22
Copy link
Author

msy22 commented Jan 10, 2019

Thanks! This was 100% my own fault because I wasn't careful enough, but unhelpful error messages are a personal bugbear of mine.

@jean821203
Copy link

I noticed a problem on the parsing of the header as well,
The random blank space at the back of each line will cause the pcl_ply2pcd not able to parse the header.
I generate my ply files via another library, thus I deleted the blank space at the end of each line in header
That solved the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants