Skip to main content

Thin Plate Spline implementation with numpy/scipy

Project description

tps

Lint and Test

Implementation of Thin Plate Spline. (For a faster implementation in torch, look at torch-tps)

Install

Pip

$ pip install thin-plate-spline

Conda

Not yet available

Getting started

import numpy as np
from tps import ThinPlateSpline

# Some data
X_c = np.random.normal(0, 1, (800, 3))
X_t = np.random.normal(0, 2, (800, 2))
X = np.random.normal(0, 1, (300, 3))

# Create the tps object
tps = ThinPlateSpline(alpha=0.0)  # 0 Regularization

# Fit the control and target points
tps.fit(X_c, X_t)

# Transform new points
Y = tps.transform(X)

Examples

We provide different examples in the example folder. (From interpolation, to multidimensional cases and image warping).

Image warping

The elastic deformation of TPS can be used for image warping. Here is an example of tps to increase/decrease the size of the center of the image or using random control points:

Input ImageIncreased ImageDecreased ImageWarped Image

Have a look at example/image_warping.py.

Build and Deploy

$ python -m build
$ python -m twine upload dist/*

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

thin_plate_spline-1.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

thin_plate_spline-1.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file thin_plate_spline-1.1.1.tar.gz.

File metadata

  • Download URL: thin_plate_spline-1.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for thin_plate_spline-1.1.1.tar.gz
Algorithm Hash digest
SHA256 904fcdd4aff81ebc03e31652cee3208400c203b3891cf264633642048812db45
MD5 dcd194d27f04d03a43e1e2953e46879d
BLAKE2b-256 d6abb02cde4ed621463f9f2b43503c923825f1fa10b83de0913743c873949e36

See more details on using hashes here.

File details

Details for the file thin_plate_spline-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for thin_plate_spline-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6116fdf4acb02f2019094a51e68f11e4321e941388ff8c27ab5d82c91ac751bf
MD5 83abf3e5ca22c740b16c1d3d8acdf171
BLAKE2b-256 b4d92e97d93eb8430e6f11e8211680019a31e45ea6408329670c1190525466f7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page