View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Fitting quadratic curves and surfaces

4.6 | 9 ratings Rate this file 36 Downloads (last 30 days) File Size: 157 KB File ID: #45356 Version: 1.4
image thumbnail

Fitting quadratic curves and surfaces



03 Feb 2014 (Updated )

Fit ellipses, ellipsoids and other quadratic curves and surfaces to noisy data.

| Watch this File

File Information

Generating points along an ellipse or ellipsoid, plotting ellipses and ellipsoids in various parametric representations, and fitting ellipses, ellipsoids or other quadratic curves and surfaces to noisy data occur frequently in fields such as computer vision, pattern recognition and system identification.
This toolbox provides a fairly comprehensive toolset of estimating quadratic curves and surfaces in an errors-in-variables context, with and without constraints. In addition to classical fitting methods such as least squares (with and without curve or surface normals), Taubin's method, direct ellipse fit by Fitzgibbon et al. [1] and direct ellipsoid fit by Qingde Li and John G. Griffiths [4], the toolbox features an estimation algorithm by the author [2,3], based on and extending the work of István Vajk and Jenő Hetthéssy [5]. The proposed quadratic curve and surface fitting algorithm combines direct fitting with a noise cancellation step, producing consistent estimates close to maximum likelihood but without iterations.

[1] Andrew W. Fitzgibbon, Maurizio Pilu and Robert B. Fisher, "Direct Least Squares Fitting of Ellipses", IEEE Trans. PAMI 21, 1999, pp476-480.
[2] Levente Hunyadi, "Estimation methods in the errors-in-variables context", PhD dissertation, Budapest University of Technology and Economics, 2013.
[3] Levente Hunyadi and István Vajk, "Constrained quadratic errors-in-variables fitting", The Visual Computer, 12 pages, in print, available on-line from October 2013.
[4] Qingde Li and John G. Griffiths, "Least Squares Ellipsoid Specific Fitting", Proceedings of the Geometric Modeling and Processing, 2004.
[5] István Vajk and Jenő Hetthéssy, "Identification of nonlinear errors-in-variables models", Automatica 39, 2003, pp2099-2107.


Levente Hunyadi

Please use my private e-mail address to submit bug reports, which will be addressed upon short notice; reviews, however, are not monitored. Any feedback is most welcome.


Quadratic Curves And Quadric Surfaces In Implicit Form and Symbolic Polynomials inspired this file.

This file inspired Hyperellipsoidfit.

Required Products Optimization Toolbox
Symbolic Math Toolbox
MATLAB release MATLAB 7.14 (R2012a)
Other requirements This submission depends "Quadratic curves and quadric surfaces in implicit form" and "Symbolic polynomials" by the same author, both of which are included. Optimization Toolbox and Symbolic Math Toolbox are optional and required only by a few features.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (11)
08 Aug 2016 Knight Jake

Awesome, thanks you

30 Jul 2016 jjj www

Thanks a lot, your code is very easy-read and useful.谢谢 :)

16 Oct 2015 Jules

Jules (view profile)

Extremely impressive code with very nice examples! Have you thought about fitting (hyperbolic) paraboloids too? :)

02 Apr 2015 Yi Zhou

Very well written. Do you provide example code of each specific type of quadric fitting in your project? I only find a general one (quad3dfit_taubin.m).

18 Feb 2015 Atipong

A very useful set of codes. well written.
not easy to use at first but powerful once you understand it.

18 Sep 2014 Martti K

Martti K (view profile)

In file quad3dfit_taubin.m, line 39 is written as

dX = dx.^2 + dy.^2 + dz.^2;

but it should be

dX = [dx; dy; dz];

Comment only
15 Sep 2014 Martti K

Martti K (view profile)

08 Aug 2014 Torsten Schönfeld

14 Mar 2014 Levente Hunyadi

optimset is a standard MATLAB function, see:

Comment only
13 Mar 2014 Carey Smith

Although the zip contains 97 files (many examples, I believe), it does not contain the needed file imconic.m.
This (by the same author) can also be downloaded, It has 24 files, but does not have optimset.m.
So I couldn't run ellipsefit.
(A search for optimset returns many files, but none by the same author, so I gave up.)

11 Mar 2014 Jean-Yves Tinevez

25 Feb 2014 1.1

Improved numerical robustness for standard least-squares estimation of ellipsoid parameters.

14 Mar 2014 1.2

Added automatic dependency check for Optimization Toolbox and suggestion which function to use when the toolbox is not installed.

12 May 2014 1.3

Included all external dependencies into a single package.

22 Sep 2014 1.4

Fixed an issue with 3D Taubin fit (contributed by Martti K).

Contact us