Skip to main content

Render large point clouds fast using Octrees in Python

Project description

OakTree

Render large point clouds efficiently using Octrees. The library is a C++ module with Python bindings for ease of use.

Quick Demo

Create an Octree from a Numpy array containing points' xyz positions and RGB intensities.

import numpy as np
from oaktree import Node

# use random points, but could be any Numpy array with shape [N, 3]
points = np.random.uniform(size=(100000, 3))
points_rgb = points.copy() / np.linalg.norm(points_rgb, axis=1, keepdims=True)
points_rgb = (points_rgb + 1) / 2

# create Octree node that allows efficient ray casting
node = Node(max_points_per_node=1000, points=points, points_rgb=points_rgb)

# camera parameters
image_hw = (640, 480)
K = np.array([[300., 0., 320.],
              [0., 300., 240.],
              [0., 0., 1.]], dtype=np.float64)
cam2world = np.array([[0.707, -0.408, -0.577, 2.0],
                      [-0.707, -0.408, -0.577, 2.0], 
                      [0.0, 0.816, -0.577, 2.0],
                      [0.0, 0.0, 0.0, 1.0]], dtype=np.float64)

# render
rgbd = node.render(K=K, cam2world=cam2world, image_hw=image_hw)
rgb = rgbd[..., :3]
depth = rgbd[..., 3]

You can run this and other examples with real datasets with

cd examples
python box.py
python wurzburg.py

Note: examples require extra dependencies including matplotlib, PIL, pandas.

Wurzburg Lecture Hall demo output depth maps:

Installation

Pypi (linux only)

pip install pyoaktree

Build from source

Build dependencies:

  • CXX compiler compatible with C++17
git clone --recursive https://github.com/eduardohenriquearnold/oaktree.git
cd oaktree
pip install .

Unit tests can be executed with

mkdir build
cd build
cmake ..
cmake --build .
ctest
# or, to see results of individual tests
./cpp_test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyoaktree-0.0.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.0 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

pyoaktree-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (224.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pyoaktree-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (225.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyoaktree-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (225.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file pyoaktree-0.0.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoaktree-0.0.1-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 44c308574b75f1e18a905a8733be9e12e4dd898473412fd6f690d468d9d2381a
MD5 60755782fbc39339a25daff8cd872d59
BLAKE2b-256 e67a98df11070fb87bea1dda33b9c8f8865fff5b5fb63bd51592e3e70bd9ec91

See more details on using hashes here.

File details

Details for the file pyoaktree-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoaktree-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6ccdb209ebb4be87e2c54e0d2d43e1de7587774b230d3ecbde3929f4b0348574
MD5 22c3d6a18b3891285b29cadf9d9fd640
BLAKE2b-256 207d49976f68673ddb3f142b453c22668abadef1a72147ae8a8d12dc79c6b2e4

See more details on using hashes here.

File details

Details for the file pyoaktree-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoaktree-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd00a6548fb39476e9a2cfa5805c76ac98ef19d6e514953c2f41cab4b5d33a1c
MD5 bac7cce55ce33844e5980a4fcd71268a
BLAKE2b-256 b991c60999f71aae4a5516ef4bc9e3a9779dcc561e8e849d632d6c3fe7ae451e

See more details on using hashes here.

File details

Details for the file pyoaktree-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyoaktree-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1bffa46aa70d929d8e5323cebaa3556ed2fc450cee9a71c7a2f3d99436a5f4d9
MD5 d12b6487a431cefc9956a5b0b89013c1
BLAKE2b-256 f5819d5235233ed189e4c536d82c78d7ece50203ca03a36495b813f0727ef8ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page