Skip to main content

PyOpenSurfaceArea

Estimates the area of an open surface represented as a point cloud in 3-D space.

Installation

Install it simply by

pip install pyosa

Usage

A simple example of estimating the surface area composed of all points within some radius around a targeted point on the surface of the Stanford bunny is shown below. Run example.py to reproduce this example.

from matplotlib.patches import Circle
import numpy as np
from scipy import spatial

import pyosa


# laod the data
xyz = np.genfromtxt('bunny100k.xyz', delimiter=' ')
    
# downsampling the point cloud just a bit for visualization purposes
N = xyz.shape[0]
num = 0.05 * N
mask = np.arange(0, N, int(N/num))
xyz_ds = xyz[mask]
    
# extract an arbitrary, open surface for which we want to extract the area
point = xyz_ds[np.argmax(xyz_ds[:, 2]), :]
tree = spatial.KDTree(xyz_ds)
r = 0.5
ind = tree.query_ball_point(point, r)

# extraction of the surface area is as simple as
surf = xyz_ds[ind]
area = pyosa.estimate(surf)

# show the resulting figure
circle = patches.Circle(point, r, fc='none', ec='k')
fig, ax  = show_pcd(xyz_ds, point, circle)  # impementation in example.py
ax.set_title(f'surface area: {area:.2f}')

Shortcomings

The current implementation is limited to open surfaces in 3-D space. The surface is assumed to have the least amount of variance in its "height" direction, that is, the surface is observed from the point of view on the normal at the center of the surface.

License

MIT

Metadata

Release files for pyosa 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyosa 0.0.1
File Size Uploaded
pyosa-0.0.1.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyosa 0.0.1
File Interpreter ABI Platform
pyosa-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / pyosa-0.0.1.tar.gz

Download URL pyosa-0.0.1.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
e246cc578e15d486056f4bf4184bcb53c400470aa4dc4f4ab4e33c4de7a0219b
BLAKE2b-256 checksum
How to use checksums
bc46341d8456f559fb5add1795086cc0cf69bf904caf1c27104b9eabdf797308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / pyosa-0.0.1-py3-none-any.whl

Download URL pyosa-0.0.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5edb33108ca01d7f25edec91b03af1e1e14b3de4c92e2ad60f8da0bc7221cf8
BLAKE2b-256 checksum
How to use checksums
286ccfa57fc0325b895e738e3b4c4b5924694fd2b1a6c08852cc14d9b0139c4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page