Skip to main content

Generate orthographic projections from a Point Cloud.

Project description

Orthographic Projector

A Rust-based Python library for generating cubic orthographic projections from point clouds.

Prerequisites

  • Python 3.10 or later
  • rustc 1.77.2 or later
  • pip

Setup

From PyPI

pip install orthographic_projector
# or
python -m pip install orthographic_projector

From source

# Clone this repository
https://github.com/akaTsunemori/orthographic_projector.git

# cd into the project folder
cd orthographic_projector

# Setup a virtual environment
python -m venv venv

# Activate the virtual environment
source ./venv/bin/activate

# Install the prerequisites
pip install -r requirements.txt

# Compile the project into a python module using maturin
maturin develop -r

Usage

import numpy as np
import open3d as o3d
import time
import cv2
import orthographic_projector


def save_projections(projections):
    for i in range(len(projections)):
        image = projections[i].astype(np.uint8)
        image_bgr = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
        cv2.imwrite(f'projection_{i}.png', image_bgr)


# Load the point cloud through open3d
PC_PATH = './examples/redandblack_vox10_1550.ply'
pc = o3d.io.read_point_cloud(PC_PATH)
points, colors = np.asarray(pc.points), np.asarray(pc.colors)

# orthographic_projector parameters
precision = 10
filtering = 2
crop = True
save = True

print('Generating projections...')
t0 = time.time()
# The generate_projections function can be used for generating the projections
images, ocp_maps = orthographic_projector.generate_projections(points, colors, precision, filtering)
# The crop parameter could optionally be passed to the generate_projections function,
# but it can also be called after the generation process
if crop:
    images, ocp_maps = orthographic_projector.apply_cropping(images, ocp_maps)
t1 = time.time()
print(f'Done. Time taken: {(t1-t0):.2f} s')

# The save_projections function is just an example intended for visualization of the results
if save:
    save_projections(images)

This example is also available in the examples/example_generate_projections.py folder.

Results

These are the generated projections to be expected from the provided example.

Spoiler Projection 1 Projection 2 Projection 3 Projection 4 Projection 5 Projection 6

References

[1] D. Graziosi, O. Nakagami, S. Kuma, A. Zaghetto, T. Suzuki, and A. Tabatabai "An overview of ongoing point cloud compression standardization activities: video-based (V-PCC) and geometry-based (G-PCC)".

[2] Osman Topçu "3D Reconstruction Of Point Clouds Using Multi-View Orthographic Projections".

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated, you can simply open an issue.

License

GNU GENERAL PUBLIC LICENSE Version 2, June 1991


GitHub @akaTsunemori

Project details


Download files

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

Source Distribution

orthographic_projector-0.1.7.tar.gz (4.0 MB view details)

Uploaded Source

Built Distribution

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

orthographic_projector-0.1.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (261.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.5+ x86-64

File details

Details for the file orthographic_projector-0.1.7.tar.gz.

File metadata

File hashes

Hashes for orthographic_projector-0.1.7.tar.gz
Algorithm Hash digest
SHA256 f27236e38fd78a904a2c7eee04a0dc003b644d8f5e02e227df76998587fe1561
MD5 55eaf8025f11274ad31e33188fa67df9
BLAKE2b-256 e8983e128b508fdf758c34ae0419948d875494d9cd4555a68d8d783ed3814c08

See more details on using hashes here.

File details

Details for the file orthographic_projector-0.1.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for orthographic_projector-0.1.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 465521d2f00beb53e70c11374bed0e3a96fcc4e1f7a4be6b322f90abd62bcac9
MD5 10decaf233fe5f86bc767d43fb818335
BLAKE2b-256 29ce55ead60da538c6b84143f62040a43645768e36d5017c230ed1dcc93c0d9f

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