Giter Site home page Giter Site logo

fwang8 / least-squares-ellipse-fitting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bdhammel/least-squares-ellipse-fitting

0.0 1.0 0.0 157 KB

Fitting an Ellipse using a Least Squares method, in Python

License: MIT License

Python 100.00%

least-squares-ellipse-fitting's Introduction

DOI

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

data = el.make_test_ellipse()

lsqe = el.LSqEllipse()
lsqe.fit(data)
center, width, height, phi = lsqe.parameters()

plt.close('all')
fig = plt.figure(figsize=(6,6))
ax = fig.add_subplot(111)
ax.axis('equal')
ax.plot(data[0], data[1], '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

@misc{https://doi.org/10.5281/zenodo.2578663,
  doi = {10.5281/zenodo.2578663},
  url = {https://zenodo.org/record/2578663},
  author = {Hammel,  Ben and Sullivan-Molina,  Nick},
  title = {bdhammel/least-squares-ellipse-fitting: Initial release},
  publisher = {Zenodo},
  year = {2019}
}

B. Hammel and N. Sullivan-Molina. bdhammel/least-squares-ellipse-fitting: Initial release, 2019.

least-squares-ellipse-fitting's People

Contributors

bdhammel avatar adler-j avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.