Giter VIP home page Giter VIP logo

fastply's Introduction

fastply

This single-include header file provides fast sequential/random read access to larger-than-memory PLY files. No framework specific types are forced on you and elements are simply represented by their equivalent C/C++ struct definition - no conversions happening! By memory-mapping files it is up to the user what to load and store in memory.

What's the catch? You need to know the definition of all elements at compile time (with the exception of how many entries per element type there are). Currently, POSIX only (tested on linux/osx), little-endian binary only (for now), and C++14 standard is required. And read-only (for now).

If you check one or more of these, maybe fastply is for you:

  • Very fast sequential and random read-only access to binary PLY files
  • Your PLY files are (much) larger than the available memory
  • Framework independent PLY reader library (type conversions are up to the user)
  • Barebones (~250LOC), header only library with a permissive license (MIT) without any dependencies, but STL

Why another PLY reader?

While there is a large amount of (C++) PLY parsers, most fall into one of two categories (or both):

  • they are very generic and make no assumption about the structure of your PLY files (category I)
  • and/or are heavily focused on a specific environment (category II)

While category I/the ability to read arbitrary PLY files (which conform to the standard) can be a big bonus, often you know exactly what types you will read in (and in C++ you need to define it anyway). PLY readers of category II have been developed inside a larger framework (think PCL) and thus often cater to the needs of that framework. Inclusion of such a massive third-party library, when all you needs is to read a ply file, is prohibitively. Also, often it comes with a lot of type conversion and potentially unnecessary allocations. With fastply's approach you will read in about 50-100x faster than other libraries.

Last but not least, most PLY readers read a PLY file in its entirety into memory. When working with PLY files larger than memory (...well maybe you shouldn't) this is more than problematic.

Installation & Usage

Several options for installation of fastply are available to your project.

By copying

fastply is a standalone header-only library without any additional dependencies. Simply copy it your project source tree.

CMake

fastply adopts the modern CMake paradigm and an interface library is exposed as a target.

First install the library to your system, for example:

mkdir build && cd build
cmake ../src -DCMAKE_INSTALL_PREFIX=<install_prefix>
cmake --build . --target install

You can now use it as a target in your project:

find_package(fastply CONFIG REQUIRED)

and configure it with

cmake .. -DCMAKE_INSTALL_PREFIX=<install_prefix>

fastply's People

Contributors

dbadrian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

stjordanis

fastply's Issues

Unsupported Element type "camera"

Thanks for your approach on reading ply files efficiently!

Unfortunately, I get the following error when reading a ply file with the header below:

unknown file: Failure C++ exception with description "Unsupported Element type camera" thrown in the test body.

It seems that the "camera" element is not supported yet. Would be great if you added support. ;-)

ply
format binary_little_endian 1.0
comment Generated by NavVis GmbH   
element vertex 7016460
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
property float curvature
element camera 1
property float view_px
property float view_py
property float view_pz
property float x_axisx
property float x_axisy
property float x_axisz
property float y_axisx
property float y_axisy
property float y_axisz
property float z_axisx
property float z_axisy
property float z_axisz
property float focal
property float scalex
property float scaley
property float centerx
property float centery
property int viewportx
property int viewporty
property float k1
property float k2
end_header

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.