Giter VIP home page Giter VIP logo

Comments (2)

mhalber avatar mhalber commented on June 13, 2024

This is a good suggestion, I'll try to add a column to lib comparison once I verify the callback support.

That being said, I am curious about your use case - I assume that you have some process that generates a lot of points and you wish to store them as .ply files? I had a bunch of ideas about changing msh_ply, so understanding this usecase better would be very useful. For example, do you know the number of point ahead of time or not?

Given that .ply is straight forward format (text header + binary or text data blob), you could set your writing like this?
Note that this is just pseudocode.

FILE* fp = fopen(filename, "wb")
ply_header_t header = setup_header_from_descriptors(descriptors, descriptor_count);
write_header(fp, &header)

while(true)
{
 vertex_t v = generate_vertex(...);
 write_vertex(fp, v);
 if (done_generating_vertices(...))
 {
   break;
 }
}

fclose(fp);

from ply_io_benchmark.

asmaloney avatar asmaloney commented on June 13, 2024

I assume that you have some process that generates a lot of points and you wish to store them as .ply files?

Yes. The thing producing the points does so in batches. So far I've just hand-coded an ASCII writer - so it looks something like this (pseudocode-ish):

      writePLYHeader();
      
      data->setPointProcessingFunc( [&]( const std::vector<PointRecord> &inList ) {
         for ( const auto &cPoint : inList )
         {
            if ( filterPoint( cPoint ) )
            {
               continue;
            }
            
            // write parts of cPoint we are interested in to PLY file
         }
      } );

      data->process(); // processes all data, calling point processing func for each batch

Where PointRecord is a struct with x, y, z, r, g, b, and some other data about a point.

It works fine (it's essentially what you have outlined in pseudocode - just with a callback), but I'd like a binary option and I also need to add the reading side, so I thought I'd look for a battle-tested, simple library to hook in here.

With a PLY library using a callback system, I think I can just connect the callback system above to it and avoid using extra storage or having to do extra processing.

do you know the number of point ahead of time or not?

I do not because of the filtering being done.

from ply_io_benchmark.

Related Issues (3)

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.