# tps
[![Lint and Test](https://github.com/raphaelreme/tps/actions/workflows/tests.yml/badge.svg)](https://github.com/raphaelreme/tps/actions/workflows/tests.yml)
Implementation of Thin Plate Spline.
(For a faster implementation in torch, look at [torch-tps](https://github.com/raphaelreme/torch-tps))
## Install
### Pip
```bash
$ pip install thin-plate-spline
```
### Conda
Not yet available
## Getting started
```python
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 Image](example/images/dog_with_bbox.png)![Increased Image](example/images/increase_warped_dog.png)![Decreased Image](example/images/decrease_warped_dog.png)![Warped Image](example/images/random_warped_dog.png)
Have a look at `example/image_warping.py`.
## Build and Deploy
```bash
$ python -m build
$ python -m twine upload dist/*
```
Raw data
{
"_id": null,
"home_page": "https://github.com/raphaelreme/tps",
"name": "thin-plate-spline",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "interpolation, numpy, machine learning",
"author": "Raphael Reme",
"author_email": "raphaelreme-dev@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/d6/ab/b02cde4ed621463f9f2b43503c923825f1fa10b83de0913743c873949e36/thin_plate_spline-1.1.1.tar.gz",
"platform": null,
"description": "# tps\n\n[![Lint and Test](https://github.com/raphaelreme/tps/actions/workflows/tests.yml/badge.svg)](https://github.com/raphaelreme/tps/actions/workflows/tests.yml)\n\n\nImplementation of Thin Plate Spline.\n(For a faster implementation in torch, look at [torch-tps](https://github.com/raphaelreme/torch-tps))\n\n\n## Install\n\n### Pip\n\n```bash\n$ pip install thin-plate-spline\n```\n\n### Conda\n\nNot yet available\n\n\n## Getting started\n\n```python\nimport numpy as np\nfrom tps import ThinPlateSpline\n\n# Some data\nX_c = np.random.normal(0, 1, (800, 3))\nX_t = np.random.normal(0, 2, (800, 2))\nX = np.random.normal(0, 1, (300, 3))\n\n# Create the tps object\ntps = ThinPlateSpline(alpha=0.0) # 0 Regularization\n\n# Fit the control and target points\ntps.fit(X_c, X_t)\n\n# Transform new points\nY = tps.transform(X)\n```\n\n## Examples\n\nWe provide different examples in the `example` folder. (From interpolation, to multidimensional cases and image warping).\n\n\n### Image warping\n\nThe 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:\n\n![Input Image](example/images/dog_with_bbox.png)![Increased Image](example/images/increase_warped_dog.png)![Decreased Image](example/images/decrease_warped_dog.png)![Warped Image](example/images/random_warped_dog.png)\n\nHave a look at `example/image_warping.py`.\n\n\n## Build and Deploy\n\n```bash\n$ python -m build\n$ python -m twine upload dist/*\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Thin Plate Spline implementation with numpy/scipy",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://github.com/raphaelreme/tps"
},
"split_keywords": [
"interpolation",
" numpy",
" machine learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b4d92e97d93eb8430e6f11e8211680019a31e45ea6408329670c1190525466f7",
"md5": "83abf3e5ca22c740b16c1d3d8acdf171",
"sha256": "6116fdf4acb02f2019094a51e68f11e4321e941388ff8c27ab5d82c91ac751bf"
},
"downloads": -1,
"filename": "thin_plate_spline-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "83abf3e5ca22c740b16c1d3d8acdf171",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5225,
"upload_time": "2024-04-26T09:01:39",
"upload_time_iso_8601": "2024-04-26T09:01:39.551145Z",
"url": "https://files.pythonhosted.org/packages/b4/d9/2e97d93eb8430e6f11e8211680019a31e45ea6408329670c1190525466f7/thin_plate_spline-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d6abb02cde4ed621463f9f2b43503c923825f1fa10b83de0913743c873949e36",
"md5": "dcd194d27f04d03a43e1e2953e46879d",
"sha256": "904fcdd4aff81ebc03e31652cee3208400c203b3891cf264633642048812db45"
},
"downloads": -1,
"filename": "thin_plate_spline-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "dcd194d27f04d03a43e1e2953e46879d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4847,
"upload_time": "2024-04-26T09:01:42",
"upload_time_iso_8601": "2024-04-26T09:01:42.222616Z",
"url": "https://files.pythonhosted.org/packages/d6/ab/b02cde4ed621463f9f2b43503c923825f1fa10b83de0913743c873949e36/thin_plate_spline-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-26 09:01:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "raphaelreme",
"github_project": "tps",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "thin-plate-spline"
}