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.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.2 kB view details)

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

pyoaktree-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (225.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pyoaktree-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (225.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyoaktree-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (225.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

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

File metadata

File hashes

Hashes for pyoaktree-0.0.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7db4d6c31fb2980df0c129356d2b20ba7061a0d405c46818a7af39387b19154f
MD5 87578d628019ea8fc82624e1a9539756
BLAKE2b-256 0f4c1fd89656825312fa1f6ab626f655216cc7c8073a95bd38b7a47c343b0b37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyoaktree-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f26125bacccaddee140f4a904a9030165bbdc5136ef856def8cf1ad0a65386ee
MD5 052ee299b798320bf58767258fdf95a7
BLAKE2b-256 b3792281d2de05b844fbeced2fbb39056ad2dc7a74b0a6a6c713011884868d8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyoaktree-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d183f069ec2092512e9cbf8e00bb829a1652b840a72e4abaa7606980b963779c
MD5 24ac2a7f1b3dd5ebe7152b6197db6f88
BLAKE2b-256 19891029440fc577a55e867d98c4314fe7efd06a204d9f10478e7f402b7c4421

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyoaktree-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26b81bec17dc1d25d95ac4678bcf157730e76e6a5314492080319daa1edec8b3
MD5 713113c0762e6e2de96672618b214b62
BLAKE2b-256 e04f8c7de2e4e02c455ca3af3258efa8f178b27dfba42e3b4a6d036f234e1557

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