Skip to main content

Lease squares fitting of Ellipses

Project description

DOI bdhammel

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()

ellipse fit

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.1.tar.gz (53.3 kB view details)

Uploaded Source

Built Distribution

lsq_ellipse-2.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file lsq-ellipse-2.0.1.tar.gz.

File metadata

  • Download URL: lsq-ellipse-2.0.1.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

Hashes for lsq-ellipse-2.0.1.tar.gz
Algorithm Hash digest
SHA256 1938128b25b843fcc0897e0401cfbc54ef43d6151b6e22de02be3518ed3be6d3
MD5 608d00965921d110fba185029a3269b0
BLAKE2b-256 0de2d9d702ce7d3446bbbdba2ccaf8e2f41aa4e0e5e4013b4c010ef0ce830595

See more details on using hashes here.

File details

Details for the file lsq_ellipse-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: lsq_ellipse-2.0.1-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

Hashes for lsq_ellipse-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4d3147d76c77387373f1a4a36983bb2f1d555ec7d6ecf8851f10f648f5f614f
MD5 dc3a0ab665dac2a0d918ce8e2fae65f9
BLAKE2b-256 a7ef8c6657f3a54c3630ff9a605f5609353bf31160ee48151d9da12dc5a7aa63

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