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 and activate the conda environment
conda env create -f environment.yml
conda activate orthographic-projector
# Compile the project into a python module using maturin
maturin develop -r
Usage
import cv2
import numpy as np
import open3d as o3d
import orthographic_projector
import time
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
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
References
-
Orthographic projector
[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".
-
Source for the example point cloud
[3] E. Alexiou, I. Viola, T. M. Borges, T. A. Fonseca, R. L. De Queiroz, and T. Ebrahimi, “A comprehensive study of the rate-distortion performance in mpeg point cloud compression,” APSIPA Transactions on Signal and Information Processing, vol. 8, 2019
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
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orthographic_projector-0.1.9.tar.gz.
File metadata
- Download URL: orthographic_projector-0.1.9.tar.gz
- Upload date:
- Size: 4.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.5.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f5f724c1074f8b7aa499f95abcf918d7794c3f920b31f64968b35419c5e8d27
|
|
| MD5 |
8af6c4a713cd14a7530ff9b465546517
|
|
| BLAKE2b-256 |
b10e6677e593cc1e5776caf904ef8ca28b704f72529c1de31353c15be9fb5dcc
|
File details
Details for the file orthographic_projector-0.1.9-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: orthographic_projector-0.1.9-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 258.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.5.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee920359063644403065702ef338b69d94dde91dfd510fac95e6dd16a4a087d9
|
|
| MD5 |
96c836cbc11306636ec663e90e0f4c2e
|
|
| BLAKE2b-256 |
b9723e85facd5ed2f05446128435799284cd783d95f39e0f20eb117003cd4071
|