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

Can't read obj_info header written by CloudCompare #12

Closed
rreusser opened this issue Aug 1, 2019 · 4 comments
Closed

Can't read obj_info header written by CloudCompare #12

rreusser opened this issue Aug 1, 2019 · 4 comments

Comments

@rreusser
Copy link
Contributor

rreusser commented Aug 1, 2019

Thanks for the great parser! We were so happy to find it. ❤️😄🌈🎉

One issue we ran into: CloudCompare writes a obj_info header, e.g.

ply
format ascii 1.0
comment Created by CloudCompare v2.10.2 (Zephyrus)
comment Created 8/1/19 9:04 AM
obj_info Generated by CloudCompare!
element vertex 4308
property float x
property float y
property float z
element face 8612
property list uchar int vertex_indices
end_header
74.5034 161.291 168.961 
77.047 149.808 164.128 
73.8367 161.097 169.151 
73.1975 160.869 169.417 
...

I can ping someone to track down the exact line of code that's failing, but it seems pretty cut and dry that you simply have to remove the obj_info line to avoid getting an error about an invalid header. Seems like just a simple obscure PLY header field that's not handled.

We'll probably have to fix this, but at the very least wanted to get it reported. Thanks again!

See also: PointCloudLibrary/pcl#2763 (comment)

@rreusser
Copy link
Contributor Author

rreusser commented Aug 1, 2019

For a start, maybe just detect it and skip it?

happly/happly.h

Lines 1485 to 1491 in 826c5ab

// Parse a comment
if (startsWith(line, "comment")) {
string comment = line.substr(7);
if (verbose) cout << " - Comment: " << comment << endl;
comments.push_back(comment);
continue;
}
Or store as a comment? (Or create a proper data structure for obj_info, but maybe that's overkill for how common/meaningful it is?)

@nmwsharp
Copy link
Owner

nmwsharp commented Aug 1, 2019

Glad hapPLY is useful for you!

Yeah, obj_info seems to be common enough that we should definitely accept files which include it...

Easy solution would be to skip such lines, but it seems a nonzero number of users pack important info in to it (see e.g. here), so it's probably worthwhile to preserve. I'm thinking just dump all obj_info lines in to a std::vector<std::string>>.

It looks like the recent pull db040e7 already added something to handle this, so I'll work a fix in with that soon.

@nmwsharp
Copy link
Owner

This should be fixed as of f196c50. obj_info lines are now treated like comments-- they can be both read and written to. Please reopen if anything doesn't seem right!

@rreusser
Copy link
Contributor Author

Thanks so much, @nmwsharp! Your quick response and fix are really, really appreciated! 🎉

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

2 participants