Skip to main content

Alphamorph

alphamorph is a Python package for non-rigid transformations of point clouds.

Unlike the traditional usage of registration between a source and a target, alphamorph transforms a source point cloud into a target shape, in this case a circle.

This is done by finding alpha shapes, that will be used as anchors for thin-plate splines.

In layman terms, it is "making the bed" by 1) finding where are the bed corners and 2) pushing and pulling the sheets!

Features

  • Point Cloud Transformation: Given a noisy point cloud, apply a non-rigid transformation so it fits a shape
  • Visualization: Easily visualize the original, distorted, and transformed point clouds.

Installation

You can install alphamorph via pip:

pip install alphamorph

Minimal Working Example

import numpy as np
from alphamorph.apply import alphamorph_apply
points = np.random.rand(1000, 2)
new_points = alphamorph_apply(points, alpha=2.5)

Full Example

Below is a simple example that demonstrates how to use alphamorph to transform a point cloud:

import numpy as np
import matplotlib.pyplot as plt
from alphamorph.geometry import generate_point_cloud, distort_point_cloud
from alphamorph.alpha import compute_alpha_shape
from alphamorph.apply import alphamorph_apply
from alphamorph.plotting import plot_point_cloud, create_color_list


np.random.seed(42)

# Generate an original point cloud and a distorted version
original_points = generate_point_cloud(num_points=2000)
color_list = create_color_list(original_points)
noisy_points = distort_point_cloud(original_points, noise_scale=0.2, num_bins=15)



# Compute alpha shapes and apply alphamorph transformation
alpha = 2.5
original_hull_indices, original_hull_points = compute_alpha_shape(original_points, alpha)
reconstructed_hull_indices, reconstructed_hull_points = compute_alpha_shape(noisy_points, alpha)
new_points = alphamorph_apply(original_points, alpha=alpha)
new_points_hull_points = new_points[reconstructed_hull_indices]

# Plot
fig, axes = plt.subplots(1, 3, figsize=(12, 6))
plot_point_cloud(axes[0], original_points, 'Original', color_list=color_list, hull_points=original_hull_points)
plot_point_cloud(axes[1], noisy_points, 'Noisy', color_list=color_list, hull_points=reconstructed_hull_points)
plot_point_cloud(axes[2], new_points, 'Noisy + Alphamorph', color_list=color_list, hull_points=new_points_hull_points)
plt.tight_layout()
plt.savefig('alphamorph_example.png')
plt.show()

Example Results

Alphamorph Example

Metadata

Release files for alphamorph 0.4.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 alphamorph 0.4.1
File Size Uploaded Provenance Actions
alphamorph-0.4.1.tar.gz 10.5 kB Without provenance Details for alphamorph-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 23.4 kB

Release files / alphamorph-0.4.1.tar.gz

Download URL alphamorph-0.4.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a160bc34fbaf82107ca0e38dd4bddea48d87d8cb37bbb2787705630f53c4641f
BLAKE2b-256 checksum
How to use checksums
9321c30f7e49cbce01be593a53270e17d032b4faee9c07e273f297868d4fb873
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release files / alphamorph-0.4.1-py3-none-any.whl

Download URL alphamorph-0.4.1-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29c01c13bcdb9c8dddfaffcff154740abaec922a862811e621c1e563b5f18891
BLAKE2b-256 checksum
How to use checksums
0ea65028f6552a2789a31fa2a87a0c64ebcee3a711202b37dd6b471ad705452b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Security for alphamorph 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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