nmwsharp / happly Goto Github PK
View Code? Open in Web Editor NEWA C++ header-only parser for the PLY file format. Parse .ply happily!
License: MIT License
A C++ header-only parser for the PLY file format. Parse .ply happily!
License: MIT License
It seems this line
std::vector<int> elementA_prop2 = plyIn.getElement("elementA").getProperty<double>("prop1");
should be
std::vector<double> elementA_prop2 = plyIn.getElement("elementA").getProperty<double>("prop1");
Very useful for writing as well.
CMake fails in the test directory due to a configuration error in Google Test. They have changed the "master" branch to "main". This issue can be resolved by changing line 8 in the test/CMakeLists.txt.in file to reflect the change in branch tag.
// TODO document
Right now the main PlyData
class cannot be implicitly copied. This is probably the right behavior; doing so is likely a mistake.
However, we can improve the situation in two ways
I am getting the following error:
error: the operand of a pointer dynamic_cast must be a pointer to a complete class type
lines: 954, 997
However, when I roll back to commit 88f7972 it works fine.
I have a custom element with a list property
:
element track 572
property list uint16 uint32 vertex_index
When trying to read it via:
const std::vector<uint32_t> track_ids = tracks.getElement("track").getProperty<uint32_t>("vertex_index");
I am getting the exception:
PLY parser: property vertex_index cannot be coerced to requested type uint. Has type unit
which is a bit confusing, since it detects the correct type (Has type unit
) but fails to convert the type to the same type (cannot be coerced to requested type uint
).
Is this a bug in the conversion, or is the uint32
type just not supported?
Hi, I'm recently working with analysis of large PLY-formatted mesh model. Since, 3D model I/O is really big bottleneck of my analysis pipeline, I'm trying to parallelizing ply parser based on this repository using the idea of [1].
If you think that this feature is worth and suitable to this repository, I'd like to contribute my implementation here.
Thanks for reading this issue.
Reference
[1] Jo, Sunghun, Yuna Jeong, and Sungkil Lee. "GPU-driven scalable parser for OBJ models." Journal of Computer Science and Technology 33.2 (2018): 417-428.
Perhaps not a hapPLY-specific issue, but still seemingly important in terms of common use cases:
hapPLY uses a face specification
property list uint uint vertex_indices
but MeshLab expects
property list uchar uint vertex_indices
(and chokes on the former).
Hi,
could we add a CMakeLists.txt file so that this library can be included using cmake or even vcpkg?
I've written an example of CMakeLists.txt, but I am no export of cmake, so I am not making a pull request.
This file can be found here for your reference.
single header makes this library easy to use. But I think cmake or vcpkg will make it easier for people to include it into their projects.
The current version of happly is quite slow for large files compared to an home-brewed solution I cooked up. The profiler suggest that the problem is allocating many small vectors in list properties. On the Lucy model from the Stanford repo, happly takes about 16 seconds of which 7 are just vector allocs. My home-brewed solution takes half that time.
I propose the following changes:
vector<vector<T>> data
to three vectors for start, count and data std::vector<size_t> start; std::vector<uint8_t> count; vector<T> data;
, where data has the concatenated list of elements, start has the starting index for each list and count contains the lists sizesgetListProperty(vector<array<T, N>>& data, vector<uint8_t>& count)
to read the data in preallocated lists; maintain previous versions for backward compatibilityIf this sounds good, I may even take a crack at it, but only if this feels right.
Hi,
This is not a bug.
Could you please give an example how to read and write a pointclošd with colors?
I noticed some of the template use in Happly is not ideal. Go back and look closer:
CanonicalName<size_t>
looks like it has a bug, perhaps not caught because no one uses 32bit machines?We already auto-convert signed to unsigned ints in some cases, to support the common situation where indices have (strangely) been stored as a signed value.
A similar issue is downconverting doubles to floats. Personally, I tend towards using double everywhere, but I think others follow the opposite policy, and they would probably be fine with the narrowing conversion.
This is probably best implemented with a special-case check, as was done with size_t.
The "Write mesh-like data" example in the Readme references fInd
, which should be meshFaceIndices
README.md says: "the code assumes the platform is little-endian." under "Known issues", but happly.h says that big endian is supported. If happly is now supporting big endian platforms, README.md should be changed, I guess.
Thanks for this nice library in just 1 file :)
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.