Skip to main content

Simple estimator of the irregular open surface area in 3-D

Project description

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

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

pyosa-0.0.1.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

pyosa-0.0.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pyosa-0.0.1.tar.gz.

File metadata

  • Download URL: pyosa-0.0.1.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyosa-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e246cc578e15d486056f4bf4184bcb53c400470aa4dc4f4ab4e33c4de7a0219b
MD5 6d1990697cf92b6499d796f95efa8f7a
BLAKE2b-256 bc46341d8456f559fb5add1795086cc0cf69bf904caf1c27104b9eabdf797308

See more details on using hashes here.

File details

Details for the file pyosa-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyosa-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pyosa-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5edb33108ca01d7f25edec91b03af1e1e14b3de4c92e2ad60f8da0bc7221cf8
MD5 ef6374fa8f84968f8e56c9f84b15706c
BLAKE2b-256 286ccfa57fc0325b895e738e3b4c4b5924694fd2b1a6c08852cc14d9b0139c4b

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