Giter Site home page Giter Site logo

rouen007 / dracopy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seung-lab/dracopy

0.0 0.0 0.0 1.71 MB

Python wrapper for Google's Draco mesh compression library.

License: Apache License 2.0

Shell 0.54% C++ 36.45% Python 32.29% Makefile 1.28% Cython 24.93% Dockerfile 4.51%

dracopy's Introduction

PyPI version Build Status

DracoPy

import os
import DracoPy

with open('bunny.drc', 'rb') as draco_file:
  mesh = DracoPy.decode(draco_file.read())

print(f"number of points: {len(mesh.points)}")
print(f"number of faces: {len(mesh.faces)}")
print(f"number of normals: {len(mesh.normals)}")

# Note: If mesh.points is an integer numpy array,
# it will be encoded as an integer attribute. Otherwise,
# it will be encoded as floating point.
binary = DracoPy.encode(mesh.points, mesh.faces)
with open('bunny_test.drc', 'wb') as test_file:
  test_file.write(encoding_test)

# If faces is omitted, DracoPy will encode a point cloud
binary = Dracopy.encode(mesh.points)

# Options for encoding:
binary = Dracopy.encode(
  mesh.points, faces=mesh.faces,
  quantization_bits=14, compression_level=1,
  quantization_range=-1, quantization_origin=None,
  create_metadata=False, preserve_order=False,
  colors=mesh.colors
)

DracoPy is a Python wrapper for Google's Draco mesh compression library.

Installation

Binary wheels are available for users with Python >= 3.6 and pip >= 20.

Installation from source requires Python >= 3.6, pip >= 10, and a C++ compiler that is fully compatible with C++11.

It supports Linux, OS X, and Windows. Numpy is required.

pip install DracoPy

Acknowledgements

We graciously thank The Stanford 3D Scanning Repository for providing the Stanford Bunny test model.

https://graphics.stanford.edu/data/3Dscanrep/

dracopy's People

Contributors

william-silversmith avatar manuel-castro avatar zeruniverse avatar denisri avatar fcollman avatar hanseuljun avatar bretttully avatar

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.