Skip to main content

Morph point clouds into circular shapes using alpha shapes and thin-plate splines.

Project description

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 and a target shape, in this case a circle.

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

Usage Example

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

import numpy as np
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_points = compute_alpha_shape(original_points, alpha)
_, reconstructed_hull_points = compute_alpha_shape(noisy_points, alpha)
new_points = alphamorph_apply(original_points, alpha=alpha)
new_points_hull_points = new_points  

# 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

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

alphamorph-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

alphamorph-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file alphamorph-0.1.0.tar.gz.

File metadata

  • Download URL: alphamorph-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for alphamorph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d7c7b23ed650703f1c0e36de4930c5a76790902cf9b43787b083c352a97ed473
MD5 99e82ce9eb1db004acd58d6b2a6df046
BLAKE2b-256 47e73a7c8742ec8b137a3b5a45a4cb1ab441e13b9f2068e0b57284b3f76dfed9

See more details on using hashes here.

File details

Details for the file alphamorph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: alphamorph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for alphamorph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1398091990d3608a9b55f3c380e74b970ac1b65d9e2ad516178490be2e512107
MD5 37f177cc84ee7b36ada763141a5d18d6
BLAKE2b-256 6c46b8c4e76c723349581b3114480b4df7d9f7d96595d03968b9c063ace0f94e

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