Mathematical Problems in Engineering

Mathematical Problems in Engineering / 2020 / Article

Research Article | Open Access

Volume 2020 |Article ID 1317349 |

Gang Zhou, Kai Zhong, Zhongwei Li, Yusheng Shi, "Direct Least Absolute Deviation Fitting of Ellipses", Mathematical Problems in Engineering, vol. 2020, Article ID 1317349, 11 pages, 2020.

Direct Least Absolute Deviation Fitting of Ellipses

Academic Editor: Thomas Schuster
Received09 Nov 2019
Revised16 Apr 2020
Accepted04 May 2020
Published11 Jul 2020


Scattered data from edge detection usually involve undesired noise which seriously affects the accuracy of ellipse fitting. In order to alleviate this kind of degradation, a method of direct least absolute deviation ellipse fitting by minimizing the algebraic distance is presented. Unlike the conventional estimators which tend to produce a satisfied performance on ideal and Gaussian noise data, while do a poor job for non-Gaussian outliers, the proposed method shows very competitive results for non-Gaussian noise. In addition, an efficient numerical algorithm based on the split Bregman iteration is developed to solve the resulting optimization problem, according to which the computational burden is significantly reduced. Furthermore, two classes of solutions are introduced as the initial guess, and the selection of algorithm parameters is studied in detail; thus, it does not suffer from the convergence issues due to poor initialization which is a common drawback existing in iterative-based approaches. Numerical experiments reveal that the proposed method is superior to its counterpart and outperforms some of the state-of-the-art algorithms for both Gaussian and non-Gaussian artifacts.

1. Introduction

Ellipse fitting is a fundamental tool for many computer vision tasks such as object detection, recognition, camera calibration [1], and 3D reconstruction [2]. A large amount of technologies have been developed for this issue and work well under the assumption that the fitting error follows a Gaussian distribution, among which Fitzgibbon’s direct least square fitting [3] has attracted a lot of attention due to its high accurateness, solution uniqueness, and fast and easy to use and has been regarded as the standardized landmark of fitting. Based on which, the scale normalization [4], robust data preprocessing for noise removal [5], optimization of the Sampson distance [6, 7], minimizing the algebraic distance in subject to suitable quadratic constraints [8, 9], and modeling the noise as a sum of random amplitude-modulated complex exponentials [10] and iterative orthogonal transformations [11] are launched. Although the performance has been improved to some extent, the inherit disadvantage of norm-based methods is that the square term will enlarge the influence of outliers and lead to a rough result. To overcome this shortcoming, the [12] and norms [13] are cited to address this issue; theoretically, it turns to be less sensitive to outliers for algorithms based on -norm , and the selection of iterative initial value is still pending yet. Given the advantage of -norm and direct algebraic distance minimizing strategy, a natural way is to replace the item with in Fitzgibbon’s model thus comes out our model, and we will explore its efficacy in the following sections.

2. The Proposed Minimization Model

2.1. Problem Modeling

For a general conic by an implicit second-order polynomial, it can be drawn aswhere  =  is denoted as the conic parameter,  =  is the data point, for every point , where N is the number of data points, and is called the algebraic distance between the data point and the conic ; note that the symbol stands for the absolute value of x. The sum of all algebraic distances at each point from 1 to N is

In order to force the conic curve into an ellipse, the parameters of the conic curve should meet the necessary conditions ; for convenience, we take its subset instead [3], and its matrix form can be rewritten as , with

Thus, the matrix form of the objective minimization model is given as follows:

By introducing the Lagrange multiplier , the constrained problem can be turned into an unconstrained one as

2.2. Numerical Aspects

Thus, our method is to seek optimal that minimizes the cost function in equation (5). The difficulty in solving equation (5) is that the term is nondifferentiable and inseparable. To overcome this problem, we follow the method of Zhou et al. [14]. The split Bregman method is first introduced in [15] as a very efficient tool to solve the general -regularized optimization problems. The basic idea is to convert the unconstrained minimization problem in equation (5) into a constrained one by introducing one auxiliary variable ; this leads to the constrained problem:

We can approximate equation (6) by adding one penalty function term as done in [16] to obtain an unconstrained problem. This yieldswhere is a positive penalization parameter. Finally, we strictly enforced the constraints by applying the split Bregman iteration [17] with a Bregman variable to obtain two subproblems:

In order to further simplify the subproblems, we split equation (8) into two separate ones. We now investigate these subproblems one by one.(1)The -related subproblem isNote that it is a least-square problem. Thus, we can obtain a closed solution as follows:(2)The -related subproblem is

This type of problem can be effectively computed using the standard soft-threshold formula presented in [16].where

The complete procedure of minimization problem equation (5) with the split Bregman iteration is summarized in Algorithm 1, where is the maximum number of iterations; to avoid the procedure falling into an invalid solution, the iteration stop criterion is set as the algebraic distance calculated on the (k + 1)-th iteration, is greater than k-th or the iterations reach to the maximum.

(3) Solve using (13)
(4) Solve using (9)
(5) Solve using (11)
(6) Set k := k + 1.
(7)end while

With the high development of the variational partial differential equation (PDE) in the field of image process, the -regularized PDE-based methods have gained more and more attention and turned out to be a promising approach for various applications such as denoise [18], destripe [19], deblur [20, 21], compressive sensing [22], and object tracking [23]. Though, the -regularized model typically achieves a very competitive performance, however, we have to select its parameters carefully or else it may fall into a local extremum and results in an undesired outcome. Almost all PDE-based methods suffer from this defect, so it is difficult to be promoted in industrial environments. Considering the classical ellipse fitting [3, 24], it aims to minimizing the following energy functional:

For it is a least-square problem, set , and we have

Comparing the solution derived from equation (11) with the solution in equation (16), when it satisfies the following conditions,the initial solution of is close to . Without losing generality, we set , forwhere x, y represents the position of the data point, thus, ; therefore, we can get . On the contrary, when , for any input data point , if and only if , where is a constant, as , the expression . Until now, only the empirical parameter is undetermined. When the ellipse parameter  =  is solved, we can normalize ; thus, it becomes  = . Then, its centroid , major semiaxis , minor semiaxis , and angle can be determined by [25]

For two ellipses E and F, their relative error can be defined aswhere denotes the area covered by ellipses E and F and simultaneously said the intersection of E and F and represents the area covered by ellipses E and F in total and said the union of E and F.

3. Experimental Results

In this section, some experiments are conducted to verify the robustness of the proposed method in suppressing the influence of noise for ellipse fitting with synthetic and natural data. Several state-of-the-art ellipse fitting algorithms are implemented for performance comparison such as Fitzgibbon’s -norm based direct least-squares ellipse fitting (DLS) [3], the hyper-least-squares fitting (HyperLS) [4], guaranteed ellipse fitting with Sampson distance (SampsonLS) [6], ElliFit [26], and the RANSAC method (RANSAC) [2] which are investigated. If there is no special explanation, all the parameters hold the same for all experiments. The scale normalization parameter is set for HyperLS. The number of sampling, the maximum number of iterations, and the threshold for eliminating the outliers in the RANSAC method are 5, 1,000, and 2, respectively, as the author advised. The parameter is set for the proposed method. We also studied the average running time of all tested algorithms as shown in Table 1.

MethodsDLSHyperLSSampsonLSElliFitRANSACProposed ()Proposed ()


3.1. Ellipse Fitting with Synthetic Data

In this section, experiments on three types of simulated ellipse data including Gaussian noise, Laplace outlier, and ellipse fragment are conducted to evaluate the performance of the proposed method.(1)In the first experiment, 256 data points were sampled from an ellipse according to a uniform sampling in angle. The noise is stochastic additive Gaussian one with mean and standard deviation , where the noise level is equivalent to of the length of the ellipse minor semiaxis . For this kind of degradation, 100 data points are polluted. Figure 1(a) gives an example of simulated ellipse points corroded with Gaussian noise with . For a total run of 100 trials at per noise level , the mean, standard deviation of the relative error, and estimated ellipse parameters are demonstrated in Table 2. It can be found that, for each noise level , the HyperLS method obtains the highest accuracy, and the proposed method () is the suboptimal. It outperforms about 30% which corresponds to the DLS method while causes a little performance reduction by 4% to HyperLS. Figures 2(a) and 2(b) demonstrate the mean and standard deviation of the relative error obtained with the tested approaches, respectively. It should be pointed out that though the DLS method indicates a more competitive stability compared with the proposed method, an obvious performance improvement has been gained by our fitting model.(2)In the second experiment, take the ellipse parameters unchanged instead of the noise type with Laplace whose mean and standard deviation hold the same as the first experiment (in this case, 64 points from 256 are selected randomly polluted by Laplace noise; an example is shown in Figure 1(b) with ). In order to illustrate the convergence behavior of the proposed algorithm, we plot the functional energy calculated by equation (5) which varies with the number of iterations as shown in Figure 3. From the figure, we can see that the proposed method () can work well in a large wide parameter space; with the increasing of , the convergent speed becomes slower gradually. Empirically, when the number of the iterations approaches 300, a satisfactory output will be gained by the proposed method. For a total run of 100 trials at per Laplace noise level , the mean, standard deviation of the relative error, and estimated ellipse parameters are demonstrated in Table 3. It can be found that the proposed method achieves the best performance at each noise level except for and even outperforms the robust RANSAC method. Figures 2(c) and 2(d) are the mean and standard deviation of the relative error obtained with the tested approaches, respectively, from which it can be declared that the RANSAC method is very robust to Laplace outliers for different noise levels; meanwhile, the proposed and the RANSAC method are far superior to the other algorithms in this case.(3)In the third experiment, we characterized a point on an ellipse by its angle with respect to the canonical Cartesian coordinate system and formed eleven groups, namely, , , , , , , , , , , and , as shown in Figure 4. For each group, we generated 100 ellipses, and for each ellipse, we sampled 256 points. Two kinds of noise are simulated including Gaussian and Laplace both of which have mean and standard deviation . Figures 5(a) and 5(b) give the estimated means and standard deviation of the relative error for the Gaussian polluted ellipse fragment, while Figures 5(c) and 5(d) correspond to its Laplace counterpart. From Figure 5, we can find that, for the Gaussian ellipse fragment, the SampsonLS and the proposed method () get the lowest relative error, while for Laplace outliers, the proposed method () and the RANSAC method take a significant promotion in accuracy as expected. Either for Gaussian or Laplace, the DLS and ElliFit methods have good stability.

MethodsNoise level Relative error






Proposed ()0.50.26%/0.1572.00/0.0564.01/0.0670.01/0.0750.00/0.0629.99/0.17

Proposed ()0.50.39%/0.2572.01/0.0964.01/0.0970.00/0.1350.00/0.1230.02/0.28

MethodsNoise level Relative error






Proposed ()0.50.14%/0.1272.00/0.0064.00/0.0070.00/0.0150.00/0.0030.00/0.01

Proposed ()0.50.42%/0.2472.00/0.1064.01/0.0969.99/0.1150.01/0.1130.03/0.26

3.2. Ellipse Fitting with Natural Data

Selective laser melting is one of the crucial steps in additive manufacturing (AM). The fusion area contour plays a very important role in geometrical quality control for AM [27]. In our project, the levelset method [28] is used to extract the profile of the part. Figure 6(a) is a frame of the image captured with a CCD camera in the fusion area. In order to highlight the visual quality, a subimage is zoomed in Figure 6(b), and its contour extract results are shown in Figures 6(c) and 6(d). It can be easily seen from Figure 6(c) that there are several bumps that appeared in the outline, owing to which, the estimated ellipse center and the major semiaxis produced an obvious offset towards the outlier excluding our fitting model as shown in Figure 7. It may can be declared that corresponding to the -norm based methods, though the proposed -norm-based model may lead to a slight performance degradation in the Gaussian outlier, it turns out to be a more robust estimator for Laplacian and Laplacian-like abrupt degradation data.

4. Conclusions

In conclusion, a novel direct -norm-based ellipse fitting model is presented in this study. It not only works well with the Gaussian outlier but also Laplacian degradation. Comparison experiments suggest that the proposed method can mitigate a wide variety of artifacts regardless of the noise type which is a very challenging issue for other state-of-the-art algorithms. Benefited from the standard , HyperLS estimator, and split Bregman iteration, its convergence behavior is tested to verify its efficacy.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.


This research was supported by the National Key R&D Program of China (Grant no. SQ2018YFB110170), the Hubei Technology Innovation Project (major project) (Grant no. 2019AAA008), and the China Postdoctoral Science Foundation under Grant 2017M612453.


  1. K. Zhong, “Pre-calibration-free 3D shape measurement method based on fringe projection,” Optics Express, vol. 24, p. 13, 2016. View at: Publisher Site | Google Scholar
  2. K. Kanatani, Y. Sugaya, and Y. Kanazawa, “Robust fitting,” in Ellipse Fitting for Computer Vision Implementation and Applications, G. Medioni and S. Dickinson, Eds., pp. 31–36, Morgan & Claypool, San Rafael, CA, USA, 2016. View at: Google Scholar
  3. A. Fitzgibbon, M. Pilu, and R. B. Fisher, “Direct least square fitting of ellipses,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 21, no. 5, pp. 476–480, 1999. View at: Publisher Site | Google Scholar
  4. K. Kanatani and P. Rangarajan, “Hyper least squares fitting of circles and ellipses,” Computational Statistics & Data Analysis, vol. 55, no. 6, pp. 2197–2208, 2011. View at: Publisher Site | Google Scholar
  5. J. Liang, M. Zhang, D. Liu et al., “Robust ellipse fitting based on sparse combination of data points,” IEEE Transactions on Image Processing : A Publication of the IEEE Signal Processing Society, vol. 22, no. 6, pp. 2207–2218, 2013. View at: Google Scholar
  6. L. Zygmunt, “Szpak, wojciech chojnacki, and anton van den hengel guaranteed ellipse fitting with the sampson distance,” in Proceedings of the European Conference on Computer Vision, ECCV, pp. 87–100, New York, NY, USA, 2012. View at: Google Scholar
  7. Z. L. Szpak, W. Chojnacki, and A. van den Hengel, “Guaranteed ellipse fitting with a confidence region and an uncertainty measure for centre, axes, and orientation,” Journal of Mathematical Imaging and Vision, vol. 52, no. 2, pp. 173–199, 2015. View at: Publisher Site | Google Scholar
  8. M. Kesäniemi and K. Virtanen, “Direct least square fitting of hyperellipsoids,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 40, no. 1, pp. 63–76, 2017. View at: Google Scholar
  9. J. Liang, Y. Wang, and X. Zeng, “Robust ellipse fitting via half-quadratic and semidefinite relaxation optimization,” IEEE Transactions on Image Processing, vol. 24, no. 11, pp. 4276–4286, 2015. View at: Publisher Site | Google Scholar
  10. S. Mulleti and C. S. Seelamantula, “Ellipse fitting using the finite rate of innovation sampling principle,” IEEE Transactions on Image Processing, vol. 34, p. 1, 2015. View at: Google Scholar
  11. A. Reza and A. S. Sengupta, “Least square ellipsoid fitting using iterative orthogonal transformations,” Applied Mathematics and Computation, vol. 314, pp. 349–359, 2017. View at: Publisher Site | Google Scholar
  12. J. Liang, “Robust ellipse fitting via alternating direction method of multipliers,” Signal Processing, vol. 34, 2019. View at: Google Scholar
  13. Z. Shi, H. Wang, C. S. Leung et al., “Robust real-time ellipse fitting based on lagrange programming neural network and locally competitive algorithm,” Neurocomputing, vol. 23, 2020. View at: Google Scholar
  14. G. Zhou, “Robust destriping of MODIS and hyperspectral data using a hybrid unidirectional total variation model,” Optik–International Journal for Light and Electron Optics, vol. 126, pp. 7-8, 2015. View at: Publisher Site | Google Scholar
  15. T. Goldstein and S. Osher, “The split Bregman method for L1-regularized problems,” SIAM Journal on Imaging Sciences, vol. 2, no. 2, pp. 323–343, 2009. View at: Publisher Site | Google Scholar
  16. Y. Wang, J. Yang, W. Yin, and Y. Zhang, “A new alternating minimization algorithm for total variation image reconstruction,” SIAM Journal on Imaging Sciences, vol. 1, no. 3, pp. 248–272, 2008. View at: Publisher Site | Google Scholar
  17. Y. Chang, L. Yan, H. Fang, and C. Luo, “Anisotropic spectral-spatial total variation model for multispectral remote sensing image destriping,” IEEE Transactions on Image Processing : A Publication of the IEEE Signal Processing Society, vol. 24, no. 6, pp. 1852–1866, 2015. View at: Google Scholar
  18. Z. Qin, D. Goldfarb, and S. Ma, “An alternating direction method for total variation denoising,” Optimization Methods and Software, vol. 30, no. 3, pp. 594–615, 2015. View at: Publisher Site | Google Scholar
  19. M. Bouali and S. Ladjal, “Toward optimal destriping of MODIS data using a unidirectional variational model,” IEEE Transactions on Geoscience and Remote Sensing, vol. 49, no. 8, pp. 2924–2935, 2011. View at: Publisher Site | Google Scholar
  20. L. Yan, H. Fang, and S. Zhong, “Blind image deconvolution with spatially adaptive total variation regularization,” Optics Letters, vol. 37, no. 14, pp. 2778–2780, 2012. View at: Publisher Site | Google Scholar
  21. H. Fang, L. Yan, H. Liu, and Y. Chang, “Blind Poissonian images deconvolution with framelet regularization,” Optics Letters, vol. 38, no. 4, pp. 389–391, 2013. View at: Publisher Site | Google Scholar
  22. J. Yang and Y. Zhang, “Alternating direction algorithms for $\ell_1$-Problems in compressive sensing,” SIAM Journal on Scientific Computing, vol. 33, no. 1, pp. 250–278, 2011. View at: Publisher Site | Google Scholar
  23. X. Mei and H. Ling, “Robust visual tracking using minimization,” in Proceedings of the 2009 IEEE 12th International Conference on Computer Vision, IEEE, New York, NY, USA, 2009. View at: Google Scholar
  24. R. Halir and F. Jan, “Numerically stable direct least squares fitting of ellipses,” in Proceedings of the 6th International Conference in Central Europe on Computer Graphics and Visualization WSCG, vol. 98, New York, NY, USA, 1998. View at: Google Scholar
  25. P. L. Rosin, “Further five-point fit ellipse fitting,” Graphical Models and Image Processing, vol. 61, no. 5, pp. 245–259, 1999. View at: Publisher Site | Google Scholar
  26. D. K. Prasad, M. K. H. Leung, and C. Quek, “ElliFit: an unconstrained, non-iterative, least squares based geometric Ellipse Fitting method,” Pattern Recognition, vol. 46, no. 5, pp. 1449–1465, 2013. View at: Publisher Site | Google Scholar
  27. Z. Li, X. Liu, S. Wen et al., “In situ 3d monitoring of geometric signatures in the powder-bed-fusion additive manufacturing process via vision sensing methods,” Sensors, vol. 18, no. 4, p. 1180, 2018. View at: Publisher Site | Google Scholar
  28. C. Li, R. Huang, Z. Ding, J. C. Gatenby, D. N. Metaxas, and J. C. Gore, “A level set method for image segmentation in the presence of intensity inhomogeneities with application to MRI,” IEEE Transactions on Image Processing : A Publication of the IEEE Signal Processing Society, vol. 20, no. 7, pp. 2007–2016, 2011. View at: Google Scholar

Copyright © 2020 Gang Zhou et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

More related articles

 PDF Download Citation Citation
 Download other formatsMore
 Order printed copiesOrder

Related articles

Article of the Year Award: Outstanding research contributions of 2020, as selected by our Chief Editors. Read the winning articles.