Lease squares fitting of Ellipses
Project description
Least Squares fitting of ellipses, python routine
based on the publication Halir, R., Flusser, J.: 'Numerically Stable Direct Least Squares Fitting of Ellipses'
Example execution
import ellipses as el
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
X1, X2 = el.make_test_ellipse()
X = np.array(list(zip(X1, X2)))
reg = LsqEllipse().fit(X)
center, width, height, phi = reg.as_parameters()
plt.close('all')
fig = plt.figure(figsize=(6,6))
ax = fig.add_subplot(111)
ax.axis('equal')
ax.plot(X1, X2, 'ro', label='test data', zorder=1)
ellipse = Ellipse(xy=center, width=2*width, height=2*height, angle=np.rad2deg(phi),
edgecolor='b', fc='None', lw=2, label='Fit', zorder = 2)
ax.add_patch(ellipse)
plt.legend()
plt.show()
Cite this work
@software{ben_hammel_2020_3723294,
author = {Ben Hammel and Nick Sullivan-Molina},
title = {bdhammel/least-squares-ellipse-fitting: v2.0.0},
month = mar,
year = 2020,
publisher = {Zenodo},
version = {v2.0.0},
doi = {10.5281/zenodo.3723294},
url = {https://doi.org/10.5281/zenodo.3723294}
}
Ben Hammel, & Nick Sullivan-Molina. (2020, March 21). bdhammel/least-squares-ellipse-fitting: v2.0.0 (Version v2.0.0). Zenodo. http://doi.org/10.5281/zenodo.3723294
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
lsq-ellipse-2.0.0.tar.gz
(53.3 kB
view details)
Built Distribution
File details
Details for the file lsq-ellipse-2.0.0.tar.gz
.
File metadata
- Download URL: lsq-ellipse-2.0.0.tar.gz
- Upload date:
- Size: 53.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9c8445107eda9baf39e08807bee7994b401d6f83064aaf926bb3500df079dde |
|
MD5 | e398d6d9b563d0874ca8feff6bb70a5e |
|
BLAKE2b-256 | ac18449477ccf7efb5ab38fd17c987fe288b6d4038fe0117de4be37cd496387f |
File details
Details for the file lsq_ellipse-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: lsq_ellipse-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d9d34811ced608cfdf9df257ac4db10d58611396757fa8ab4f7b77366e93c30 |
|
MD5 | dca43a3ea1f46247410ce77603314db8 |
|
BLAKE2b-256 | 99da4c436932155c1ac707dce0cf4dcb8345e1890ae569ec8716d3b80be1fcef |