Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

J Math Imaging Vis (2017) 58:189–210

DOI 10.1007/s10851-016-0700-6

Robust Fitting of Ellipsoids by Separating Interior and Exterior


Points During Optimization
Ezequiel López-Rubio1 · Karl Thurnhofer-Hemsi1 · Óscar David de Cózar-Macías2 ·
Elidia Beatriz Blázquez-Parra2 · José Muñoz-Pérez1 · Isidro Ladrón de Guevara-López2

Received: 27 January 2016 / Accepted: 9 December 2016 / Published online: 24 December 2016
© Springer Science+Business Media New York 2016

Abstract Fitting geometric or algebraic surfaces to 3D data tern recognition, computer vision and computer graphics
is a pervasive problem in many fields of science and engineer- with numerous applications. The 2D case involves fitting
ing. In particular, ellipsoids are some of the most employed a quadratic curve to a set of sample points on the plane
features in computer graphics and sensor calibrations. They [8,38,49,65,73]. Also, the ellipticity and circularity of the
are also useful in pattern recognition, computer vision, body set of samples can be measured [48]. The 3D case con-
detection and electronic device design. Standard ellipsoid sists in fitting a quadratic surface to a set of points in space
fitting techniques to solve this problem involve the minimiza- [56], which has applications to 3D reconstruction [12], pose
tion of squared errors. However, most of these procedures are estimation [39], restricted stereo correspondence problem
sensitive to noise. Here, we propose a method based on the [10] and object recognition [5,57]. Moreover, fitting alge-
minimization of absolute errors. Although our algorithm is braic surface with scatter 3D points has been discussed
iterative, an adaptive step size is used to achieve a faster con- widely in [40] and some remarkable work has been done
vergence. This leads to a substantial improvement in robust- in [34,35,53,63,66,67].
ness against outlier data. The proposal is demonstrated with One of the most used geometric primitives is the ellip-
several computational examples which comprise synthetic soid, which has a paramount importance in many fields.
data and real data from a 3D scanner and a stereo camera. For instance, it is employed in calibration for three-axis
magnetic sensors, as shown in [21], where a mathematical
Keywords Least absolute error · Ellipsoid fitting · Outliers · model is proposed for scalar calibration of a single three-axis
Robust estimation · Gradient descent magnetometer and a least squares ellipsoid fitting algorithm
to estimate the detailed error parameters. Three-axis mag-
netometers are used to measure the intensity of the Earth
1 Introduction magnetic field, being widely applied in navigation systems
and aircraft [45]. According to Gietzelt et al. [23], it is known
In recent years, research concerning computer vision has that calibration algorithms for three-dimensional accelerom-
developed rapidly. Fitting primitive models such as a eters and magnetometers are equivalent to a 3D-ellipsoid
quadratic curve or surface to a given cloud of points is fitting problem. Most calibration algorithms are based on
a fundamental task in digital image analysis, visual pat- 3D ellipsoid fitting methods, which minimize a cost func-
tion to estimate the value of a set of calibration parameters
B Ezequiel López-Rubio that define the sensor model. These algorithms are generally
ezeqlr@lcc.uma.es employed in micromagnetometer calibration for accurate ori-
1
entation estimation [79], micromagnetometers, together with
Department of Computer Languages and Computer Science,
inertial sensors and also, to calibrate magnetic angular rate
University of Málaga, Bulevar Louis Pasteur, 35, 29071
Málaga, Spain and gravity (MARG) sensors, Olivares et al. [50] or in inte-
2 grated calibration of magnetic gradient sensor systems [21].
Department of Graphic Expression, Design and Projects,
University of Málaga, Calle Dr Ortiz Ramos, 29071 Málaga, Many commercial electronic devices need to solve 3D
Spain ellipsoid fitting problems. Smartphones, tablets, GPS navi-

123
190 J Math Imaging Vis (2017) 58:189–210

gators [16,41], watches and videogame peripherals comprise out by second-order cone programming, linear programming
accelerometers and magnetometers that are used to estimate or the proximal bundle method. In the linear programming
the orientation of a body in space [15], compute trajectories case, the introduction of auxiliary variables enables the refor-
[36,52,61], analyze motion [9,24,64], detect obstacle col- mulation of the absolute values into linear functions.
lision [54], and other innovative measurement applications Our approach considers a much more restricted class of
such as 3D scanning [27] or in reverse engineering by a laser surfaces, namely ellipsoids. This means that the surface can-
scanner point data from the surface of an object [43]. not be deformed locally, i.e., there are no control points. Foot
In the medical field, fitting ellipsoids has been used for points are not necessary in our approach because the ana-
estimating diameters of pulmonary nodules [37] as a tech- lytic form of the ellipsoid allows computing the deviation
nique to extract a pulmonary nodule from helical thoracic of the sample points from the surface without foot points.
computed tomography (CT) scans and estimate its diame- The objective function is nonlinear, so a specifically tuned
ter. Another outstanding study is presented by Ge et al. [22], version of gradient descent is used instead of linear program-
in which a computer-aided detection system is developed to ming. The role of the reformulation of the absolute value by
assist radiologists in the detection of lung nodules on tho- auxiliary variables in Flöry and Hofer’s method is accom-
racic CT images, using a 3D gradient field method and 3D plished in our method by the split of the point cloud into two
ellipsoid fitting. Furthermore, Karnesky et al. [33] has studied sets, namely the interior points and the exterior points.
the coalescence of γ  (L12 ) precipitates in Ni–Al–Cr through From the above it can be said that, although the kind of sur-
the best-fit ellipsoids of atom-probe tomographic data, since faces to be fitted and the methodology of our proposal differ
best-fit ellipsoids have equivalent centroids, moments of iner- significantly from Flöry and Hofer’s, both take advantage of
tia, and principle axes for arbitrarily shaped precipitates. the robustness against outliers provided by L1 optimization.
Additionally, [44] suggested a 3D semi-automatic prostate This paper is structured as follows. Section 2 presents
segmentation method for B-mode Trans-Rectal UltraSound previous works and the definition of earlier ellipsoid fitting
(TRUS) images, where it is assumed that the prostate methods. Subsequently, Sect. 3 describes the formulation of
transversal section shape may be a tapered ellipse. our method and Sect. 4 reports the obtained experimental
Other research fields are focused on body detection or results using synthetic and real data. Finally, Sect. 5 summa-
classification, such as nose tip detection by Sarakon et al. rizes the main conclusions of this research.
[58]. This is useful because the nose is a facial feature whose
shape is not affected by facial expressions and is visible for
almost any orientation of the head [68]. Furthermore, the 2 Previous Work
nose is often used as a baseline to localize other facial land-
marks such as the eyes and the mouth. Other approaches In the literature, a wide range of fitting techniques have been
include [59] which proposes a noncontact method to clas- applied depending on the researcher. There are two main
sify the face shape by using Support Vector Machine (SVM) categories of fitting methods [45,75], namely using algebraic
technique and Mahalanobis distance applied to define a pre- distances [2,30] or geometric distances [1,6,20,25,57,62]
cise head region. Moreover, Grammalidis and Strintzis [26] according to their error distance definitions. Algebraic fitting
suggested a head detection of a person and tracking system methods often yield a noniterative unique solution, while
by 2D and 3D ellipsoid fitting by K-means algorithm in head geometric ones make use of some nonlinear constraints by
segmentation and 3D ellipsoid model. iterative algorithms [49].
The minimization of the sum of absolute errors (also called In 2004, Li et al. [40] explain that ellipsoid fitting
L1-norm minimization) has been used previously to fit sur- can be accomplished in many ways by applying some
faces in 3D. The method by Flöry and Hofer [19] is aimed known bounded surface fitting techniques, see [34] and [67].
to fit B-spline surfaces, so that the spline control points can Even so, these techniques involve a nonlinear optimization
be displaced slightly to deform the surface locally in order method, which cannot guarantee an optimal solution and
to fit the local features of the point cloud. This requires the stops at a local minimum. Their purpose is to develop an
use of a foot point in the surface for each sample point, so effective and efficient ellipsoid fitting algorithm and not to
that the distance of the sample to the surface is computed consider those fitting methods based on the geometric dis-
with respect to the foot point. Then one can use three (non- tance or the parametric representation of an ellipsoid, since
squared) distance measures: (a) the distance between the foot they give rise to a lengthy nonlinear optimization process.
point and the sample point, (b) the distance from the tangent In contrast, Yu et al. [76] mention that general ellipsoids
plane at the foot point to the sample point, (c) a second-order do not have a natural geometric definition similar to ellipses
approximant of the signed distance function, based on the or spheroids. Anyway, they can still generalize the ellipse
local Frenet frame associated to the foot point. Depending fit algorithm to three dimensions in the case of a spheroid,
on the chosen option the L1 distance minimization is carried since a spheroid has the same basic geometric property as an

123
J Math Imaging Vis (2017) 58:189–210 191

ellipse. This is the reason that all algorithms proposed in two n-D ellipsoid. Fortunately, to ensure that a matrix is positive
dimensions can be easily generalized to three dimensions in or opposite definite, the most practical way may be to utilize
a natural way. semidefinite programming (SDP) as Calafiore proposed [4].
However, in Calafiore’s method, the run time is significantly
2.1 Algebraic Fitting Methods long and memory is often exhausted when the number of
fitted points is greater than several thousands. Hence, Ying
According to Malyugina et al. [45], the existing methods et al. [75] proposed a fast algorithm by minimizing a new
of ellipsoidal fitting are mainly based on the least squares defined vector norm of the algebraic residual vector using
method. Methods of this group use an algebraic approach SDP by decreasing the dimensions of the SDP problem.
regarding an implicit representation of the quadratic surface Another approach is Koopmans’s method that generalized
that [40] defines as the locus of points such that their coordi- the Least Squared (LS) estimation scheme by developing a
nates satisfy the most general equation of the second degree maximum likelihood (ML) estimation. In order to assume
in three dimensions: extended observation vectors and LS it computes an algebraic
fit where the norm vector of the ten parameters describing the
ax 2 + by 2 + cz 2 + 2 f yz + 2gx z + 2hx y ellipsoid algebraically (1) is equal to 1.
+2 px + 2qy + 2r z + d = 0 (1)
2.2 Geometric Fitting Methods
Now, let
Some methods have a geometrical definition of error dis-
tance, so that the shortest distance from the data point to the
I = a+b+c surface is computed. Though those geometric methods give
J = ab + bc + ac − f 2 − g 2 − h 2 better solutions, they require more time for evaluation.
 
a h g  In the literature until 2002, Calafiore [4] first proposed
 
K =  h g f  a feasible approach for multidimensional ellipsoid-specific
g f c  fitting using semidefinite programming (SDP), which min-
imizes the 2-norm of the algebraic residual vector, who
then it is known that they are invariant under rotation and presented the solution of spherical and ellipsoidal fitting
translation and Eq. (1) represents an ellipsoid if J > 0, I K > based on a “difference-of-squares” (DOS) geometric error
0 in [28]. criterion for points in n-dimensional space using Eq. (2)
In [40] it is shown that when a J − I 2 > 0, Eq. (1) must expressed in 3D form:
represent an ellipsoid if a = 4. Hence, some authors that use  2
the least squares fitting problem based on algebraic distance f (c, A, r ) = d 2 (xi , c) − d 2 (x̃i , c) (2)
must consider this constraint. In Direct method (DM) [40]
the constraint confines the class of ellipsoids to fit to those where c is the center of ellipsoid, A is a symmetric positive
whose smallest radius is at least half of the largest radius; in definite matrix that defines the shape of the ellipsoid, r is
the Simple method, the ellipsoid is fitted by bisection search represented by (x − c)T A (x − c), d (a, b) denotes a metric
on a in equation a J − I 2 > 0. distance between the points a and b, and x̃i is the point on
Ying et al.’s [75] work intends to find an algebraic method the ellipsoid that lies on the ray xi c.
for multidimensional ellipsoid-specific fitting, rather than fit- More recent approaches include the Distance method [32]
ting general quadratic surfaces. They draw inspiration from which intends to calculate the orthogonal distance of the
a study on the ellipse-specific fitting approach proposed by points projected onto an ellipsoid. Eberly [14] defines the
Fitzgibbon et al. [18] since it outperforms other approaches error as the normal distance from the point of the cloud to
because it is robust, efficient and easy to implement. How- the ellipsoid. The closest point on the ellipsoid is found by a
ever, they mention that using linear least-square techniques Newton’s iteration scheme. He develops methods of hyper-
with a constraint whose degree is greater than 2 is very dif- planar fitting and surface fitting for several kinds of quadric
ficult to carry out. curves and surfaces. In the problem of ellipsoidal fitting he
Also, as it is well known, a quadratic surface in n- focuses on axis-aligned ellipsoids.
dimensional space is defined as the locus of the zeros of
a quadratic polynomial. This quadratic polynomial may be
written in a different notation as a real symmetric matrix 3 Methodology
of order n + 1 and an (n + 1)-vector. The leading n × n
principal submatrix of the symmetric matrix is positive or Our ellipsoid fitting methodology is presented next. In gen-
opposite definite whenever the n-D quadratic surface is an eral terms, it is better to consider criteria based on the sum

123
192 J Math Imaging Vis (2017) 58:189–210

of the absolute error values to detect the presence of outliers Then we substitute (8) into (5), which leads to (3) by appli-
[31,47,55,69]. In this paper, we consider a criterion based on cation of (7).
the mean absolute deviation from the level set which defines The ellipsoid divides the space R3 into two regions. The
the ellipsoid surface. The proposed algorithm provides good interior of the ellipsoid is:
results for a set of points that are not truly geometrically pre-  
cise ellipsoids but rough ellipsoid or egg-like shapes, e.g., real I = x ∈ R3 | (x − a)T B−1 (x − a) < 1 (9)
image applications for agricultural images and many other
nearly round shapes. On the other hand, the exterior of the ellipsoid is:
We start with a review of some basic facts about ellipsoids
 
(Sect. 3.1). Then the proposed fitting method and its conver-
O = x ∈ R3 | (x − a)T B−1 (x − a) > 1 (10)
gence control procedure are stated in Sects. 3.2 and 3.3. After
that, the initialization procedure is detailed in Sect. 3.4 and
Next these concepts are applied to robust fitting.
a summary of the algorithm is provided in Sect. 3.5. Finally,
a discussion of the most important features of our proposal
3.2 Robust Fitting
is given in Sect. 3.6.
Let us consider a finite set of M input data points in R3 :
3.1 Preliminaries
 
The equation of an ellipsoid reads as follows: S = xi ∈ R3 | i ∈ {1, . . . , M} (11)

(x − a)T B−1 (x − a) = 1 (3) Please note that no normal vectors are provided as inputs,
only the data points. The task is to fit an ellipsoid to the input
where a ∈ R3 is the center of the ellipsoid (a 3-dimensional points in S.
vector), and B ∈ R3×3 is a 3 × 3 positive definite matrix. The Here we propose to use the least absolute error rather than
eigenvectors of B are the major axes of the ellipsoid, while the least squared error, so as to obtain a robust performance
their associated eigenvalues are the squares of the lengths of criterion [3]. Our proposed error measure is:
these major axes. It must be noted that the ellipsoid surface 

1 
M
is the unit level set f (x) = 1 of this function: E= I (xi ∈ O) T −1
(xi − a) B (xi − a) − 1
M
 i=1
f (x) = (x − a)T B−1 (x − a) 

1 
(4) M
T −1
+ I (xi ∈ I ) 1 − (xi − a) B (xi − a)
M
The ellipsoid can be obtained by affine transformation i=1
from the unit sphere with center at the coordinate origin, +λ a (12)
whose equation is:
where λ is a positive weighting parameter for the last term
y y=1
T
(5) which ensures that the solution does not go to infinity, i.e.,
a → ∞, and I is the indicator function:
This is achieved by application of the following affine
transform: 1 iff condition is true
I (condition) = (13)
0 iff condition is false

x = Ly + a (6) It must be noted that a ellipsoid with a far enough center


a can fit any finite set of points; hence, the need for the last
where L is a 3 × 3 lower triangular matrix obtained by term of (12). Also, it must be highlighted that the definitions
Cholesky decomposition of B; please note that B admits such of the interior set (9) and the exterior set (10) are referred to
decomposition because it is positive definite: the current estimation of the ellipsoid parameters B and a, so
both sets are updated as the estimation changes. This implies
B = LLT (7) that all the terms of (12) are nonnegative, so that E ≥ 0. In
turn this means that (12) is equivalent to:
In order to see this, from (6) we have: M  
1   
E=  (xi − a) B (xi − a) − 1 + λ a
T −1
(14)
y = L−1 (x − a) (8) M
i=1

123
J Math Imaging Vis (2017) 58:189–210 193

which expresses E as the mean of the absolute errors plus In this work we propose to estimate the error trend in
the weighted normalization term. a robust way. To this end, at time instant t the median of
Gradient descent is used to minimize E. Consequently, the errors at time instants t, t − 1, . . . ., t − T is compared
the gradient with respect to B is computed: to the median of the errors at time instants t − T − 1, t −
T − 2, . . . ., t − 2T , and a binary variable ξ (t) ∈ {−1, 1} is
1  1 − 1
M
∂E obtained:
(xi − a)T B−1 (xi − a)
2
=− I (xi ∈ O)
∂B M 2
i=1
Ê new (t) = median (E (t) , E (t − 1) , . . . ., E (t − T ))
×B−T (xi − a) (xi − a)T B−T
(20)
1  1 − 1
M
(xi − a)T B−1 (xi − a)
2
+ I (xi ∈ I ) Ê old (t) = median (E (t − T − 1) , E (t − T − 2) ,
M 2
i=1 . . . ., E (t − 2T )) (21)
×B −T
(xi − a) (xi − a)T B−T (15)
−1 iff Ê new (t) < Ê old (t)
ξ (t) = (22)
where we note: 1 iff Ê new (t) ≥ Ê old (t)
 T
B−T = B−1 (16) where ξ (t) = −1 indicates that the error exhibits a decreas-
ing trend.
Next the gradient with respect to a is obtained as follows: Then the step size is updated according to the trend ξ (t):

1 
M
∂E a ⎨ρup η (t) iff ξ (t) = −1 and η (t) < ηmax
=λ − I (xi ∈ O)
∂a a M η (t + 1) =
⎩ρ
down η (t) iff ξ (t) = 1 and η (t) > ηmin
i=1
 − 1
−1 2 −1
× (xi − a) B T
(xi − a) ×B (xi − a) (23)
 − 1 0 < ρdown < 1 (24)
1 
M
I (xi ∈ I ) (xi − a)T B−1 (xi − a)
2
+ ρup > 1 (25)
M
i=1 ηmin < ηmax (26)
−1
×B (xi − a) (17)
where ρup and ρdown control the size of the update of η, and
Consequently, the gradient method yields the following
ηmin and ηmax set limits for such update. It has been found in
update equations:
practice that by taking T = 5, ρup = 1.1 and ρdown = 0.9 the
∂E step size adaptation procedure is stabilized, so these values
B (t + 1) = B (t) − η (t) (t) (18) have been used in all the reported experiments. In order to
∂B
∂E save computation time and improve stability, the above step
a (t + 1) = a (t) − η (t) (t) (19) size update procedure is only carried out when t is a multiple
∂a
of 2T .
where t is the time instant and η (t) is the step size.
3.4 Initialization
3.3 Robust Convergence Control
Here the initialization procedure to obtain the starting values
In order to achieve a faster convergence, an adaptive step
B (0) and a (0) for t = 0 is described. It is necessary to
size η (t) is used which depends on the time instant t. The
produce an initial value of B (0) which is a positive definite
step size should increase when the error decreases in order to
matrix, as indicated in Sect. 3.1. To this end, we take a (0)
advance faster to the local minimum, while it should decrease
as the mean of the training data, and B (0) as the covariance
when the error increases in order to avoid further degradation
matrix of the data:
of the current solution due to wrong updates [46,49,71]. A
potential source of instability in the fitting algorithm is that
1 
M
the error could exhibit a large variability within a given region a (0) = xi (27)
of the search space. This could lead to wrong updates of the M
i=1
step size, which in turn would increase the variability of the
1 
M
error. Therefore, the stability of the method can be enhanced B (0) = (xi − a (0)) (xi − a (0))T (28)
by computing a robust estimation of the current error. M
i=1

123
194 J Math Imaging Vis (2017) 58:189–210

Fig. 1 Four examples of the L1 linear programming fit using the general equation (1) versus our proposal. N = 100 samples were used for the
simulations, percentage of added outlier data P = 10% and Gaussian noise level for inliers σ = 0.01

Equations (27) and (28) ensure that B (0) is positive defi- Table 1 Quadratic surface types obtained by the L1 linear program-
nite except in case that a degenerate training set is provided ming fit using the general equation (1) over 100 simulations
which lies in a plane. In case that a more robust initialization Type of quadratic surface %
is necessary, robust covariance matrix estimation methods are
Hyperboloid of one sheet 66
available [7,29,77]. They have not been used here because
Hyperboloid of two sheets 10
the above procedure yields good results with a reduced com-
putational complexity. Ellipsoid (real) 24

123
J Math Imaging Vis (2017) 58:189–210 195

Coefficient errors 7. If an error goal or an iteration limit have been reached,


2
then go to step 8. Otherwise, go to step 2.
1 8. Output the best found solution, i.e., the values of a and
B associated to the minimum recorded value of E, and
0
log 10 (e coeff)
then halt.
-1
3.6 Discussion
-2

-3 In this subsection some important aspects of our proposal


are discussed. In particular, the differences of our approach
-4 with respect to previous methods are considered, and some
L1 linear fit Proposed fit
directions for future research are outlined.
Fig. 2 Coefficient errors of the L1 linear programming fit and the pro- First of all, it must be studied why standard methods for
posed fit. Boxplots of the 2-norm errors between the true and the fitted L1-norm minimization cannot be employed in our approach.
coefficients of Eq. (1) over 100 runs are displayed (in a logarithmic
One of the best known approaches to replace least squares
scale). In the boxplots, the medians are plotted as horizontal gray lines,
while the means are plotted as gray circles minimization by a Lp-norm is the iteratively reweighted least
squares (IRLS) method [13,74]. It employs specially selected
weights for the input samples so that Lp-norm minimization
3.5 Summary can be obtained by solving a weighted least squares problem.
It has been successfully applied to various problems in image
The proposed algorithm can be summarized as processing and computer vision [11,17,51]. However, IRLS
follows: is only suitable for problems with a linear objective function.
In our case, the proposed objective function (14) is nonlinear,
which precludes the use of IRLS.
1. Set the initial values of a and B according to (27) and The nonlinearity of the objective function also excludes
(28), respectively. linear programming as an alternative. It should be noted that
2. Record the value of the error E for the current solution. the general equation of 3D quadratic surfaces (1) is linear in
3. Classify the training data into interior or exterior points the 10 parameters a, b, c, d, f , g, h, p, q, r . Therefore, it
with (9) and (10). can be used to carry out a L1 norm optimization by linear
4. Find ∂∂BE and ∂∂aE by equations (15) and (17), respectively. programming. However, the best fit to the data might not be
5. Update the current values of B and a according to (18) an ellipsoid because (1) describes other kinds of surfaces. In
and (19), respectively. order to illustrate this point, Fig. 1 depicts an example of the
6. If the time instant t is a multiple of 2T , then update the results of the L1 linear programming fit compared with the
step size according to (23). true ellipsoid given by synthetic dataset and also the output

Fig. 3 Results of our algorithm 2.5


with perturbed initial
estimations of the ellipsoid 0.6
2
parameters, generated by the
0.5
addition of Gaussian noise with
standard deviation ρ: a error 0.4 1.5
E

measure E versus time step t, b


learning rate η versus time step 0.3
1
t, c legend
0.2
0.5
0.1

0 0
0 1 2 3 4 5 0 0.5 1 1.5 2
log 10 (t) t 10 4

(a) (b)

= 0.01 = 0.05 = 0.1 = 0.25 = 0.5 =1

(c)

123
196 J Math Imaging Vis (2017) 58:189–210

Center position Distance matrix Volume


4 5
2
3 4

1
2 3
log 10 (e a )

log 10 (e B )

log 10 (e V )
0 2
1
1
-1 0
0
-2 -1
-1
50 100 150 200 250 50 100 150 200 250 50 100 150 200 250
N N N
(a) (b) (c)
First principal axis length Angular orientation Running time
5 60

4 50 0

log 10 (CPU time)


3 40
log 10 (e )

-1
2 30
e

1 20 -2

0 10
-3
-1 0
50 100 150 200 250 50 100 150 200 250 50 100 150 200 250
N N N
(d) (e) (f)
ours direct koopmans distance leastsquares simple

Fig. 4 Comparison of the performance metrics of all methods depend- length error, e median of the orientation errors for the three ellipsoid
ing on the number of data points. Fixed values σ = 0.01 and P = 10% axes (degrees), f running time (seconds). In the boxplots, the medians
were used as N was varied. Boxplots of 100 runs are displayed: a cen- are plotted as horizontal gray lines, while the means are plotted as gray
ter error, b distance matrix error, c volume error, d first principal axis circles

of our proposed algorithm. As seen, L1 norm optimization Quadratic programming and other more general
yields non-ellipsoidal surfaces in many cases, as equation approaches such as semidefinite programming [72] cannot be
(1) represents 17 types of quadratic surfaces. In Table 1 the applied either, because our objective function (14) involves
surface types obtained in 100 runs with different random the square root of a nonlinear function of the unknown param-
samples are reported. We can observe that 76% of the runs eters of the ellipsoid B and a.
yield an hyperboloid of one or two sheets, while an ellipsoid Next some possible extensions of our approach are out-
is obtained in only 24% of the cases. Moreover, when an lined. It must be highlighted that the framework presented
ellipsoid is obtained the fit is far worse than ours, as seen in here could be extended to other error norms by changing the
Fig. 1(b). The 2-norm of errors ecoeff in the coefficients of error measure E in equation (12), given a method to compute
the general equation between the true ellipsoid and the fitted the gradients ∂∂BE and ∂∂aE . It might be applied to fit hyperel-
surface were calculated for both the L1 linear programming lipsoids in dimensions higher than 3, since the derivations in
fit and the proposed method: Sects. 3.1 and 3.2 are still valid in Rn for n ≥ 3. In princi-
ple, it could be extended to other quadratic forms or higher
α = (a, b, c, d, f, g, h, p, q, r ) (29)
degree polynomials in implicit form F (x) = 0 by defining
ecoeff = ||αtrue − αfit || (30) two regions F (x) > 0 and F (x) < 0. In this case, the gradi-
1 1
ents of (F (x)) d and (−F (x)) d with respect to the surface
Figure 2 displays the boxplots of those errors for the 100
parameters would be required, respectively, where d is the
runs (in a logarithmic scale). There is a large difference in
degree of the polynomial F.
the coefficient errors, which means that the proposed method
outperforms the L1 linear programming fit.

123
J Math Imaging Vis (2017) 58:189–210 197

Center position Distance matrix Volume


3 5
4
2 4
3
1 3
log 10 (e a )

log 10 (e B )

log 10 (e V )
2
0 2
1 1
-1
0 0
-2
-1 -1
-3
-2 -2
0.001 0.005 0.01 0.05 0.1 0.001 0.005 0.01 0.05 0.1 0.001 0.005 0.01 0.05 0.1

(a) (b) (c)


First principal axis length Angular orientation Running time
5 60

4 50 0

log 10 (CPU time)


3
40
log 10 (e )

2 -1
30
e

1
20 -2
0

-1 10
-3
-2 0
0.001 0.005 0.01 0.05 0.1 0.001 0.005 0.01 0.05 0.1 0.001 0.005 0.01 0.05 0.1

(d) (e) (f)

ours direct koopmans distance leastsquares simple

Fig. 5 Comparison of the performance metrics of all methods depend- principal axis length error, e median of the orientation errors for the
ing on the Gaussian noise level for the inliers. Fixed values N = 100 three ellipsoid axes (degrees), f running time (seconds). In the box-
and P = 10% were used as σ was varied. Boxplots of 100 runs are plots, the medians are plotted as horizontal gray lines, while the means
displayed: a center error, b distance matrix error, c volume error, d first are plotted as gray circles

4 Experimental Results 4.1 Synthetic Data

In this section computational experiments for different data As a first experiment, some synthetic data with added outlier
sets are reported.1 The following competing methods have points are used to compare to previous methods. In order to
been chosen for comparison: study how our algorithm depends on the initial estimation of
the ellipsoid parameters, an experiment has been carried out
– Direct Method (DM) [40], which perturbs the initial estimations of the center a and the
– Least Square (LS), [32], distance matrix B through the addition of Gaussian noise to
– Koopmans method, [70], the training samples used to compute a (0) and B (0), with
– Distance, [32] and standard deviations ρ = 0.01, 0.05, 0.1, 0.25, 0.5, 1. Please
– Simple [40]. note that the training samples for the subsequent steps of the
algorithm are not corrupted by this Gaussian noise.
The error measure E (equation 14) and the learning rate
Three kinds of data have been employed: synthetic data
η (step size) along the execution steps of the algorithm have
(Sect. 4.1), data from a 3D scanner (Sect. 4.2), and finally
been recorded. The results are shown in Fig. 3. These results
stereo image pairs from a calibrated stereo camera (Sect. 4.3).
demonstrate that regardless of the initial estimation of the
ellipsoid, the final measured error is almost the same, even
1 The source code and some demos of our approach are published in in the case of large initial perturbations. It must be noted that
http://www.lcc.uma.es/%7Eezeqlr/ellipsoid/ellipsoid.html.

123
198 J Math Imaging Vis (2017) 58:189–210

Center position Distance matrix Volume


5
8 8
4

3 6 6
log 10 (e a )

log 10 (e B )

log 10 (e V )
2
4 4
1

0 2 2

-1
0 0
-2

0.05 0.1 0.15 0.2 0.25 0.05 0.1 0.15 0.2 0.25 0.05 0.1 0.15 0.2 0.25
P P P
(a) (b) (c)
First principal axis length Angular orientation Running time
60
8
50 0

log 10 (CPU time)


6
40
log 10 (e )

-1
4 30
e

2 20 -2

0 10
-3
0
0.05 0.1 0.15 0.2 0.25 0.05 0.1 0.15 0.2 0.25 0.05 0.1 0.15 0.2 0.25
P P P
(d) (e) (f)
ours direct koopmans distance leastsquares simple

Fig. 6 Comparison of the performance metrics of all methods depend- length error, e median of the orientation errors for the three ellipsoid
ing on the percentage of outliers. Fixed values N = 100 and σ = 0.01 axes (degrees), f running time (seconds). In the boxplots, the medians
were used as P was varied. Boxplots of 100 runs are displayed: a cen- are plotted as horizontal gray lines, while the means are plotted as gray
ter error, b distance matrix error, c volume error, d first principal axis circles

initial values of E are lower for higher values of ρ. This is


a = a − atrue  (31)
because higher noise ρ produces a covariance matrix of the
B = B − Btrue  (32)
data B (0) with a higher value of det (B (0)) due to the higher π 3/2 
dispersion of the data. This implies that (x − a)T B−1 (x − a) V = 3  det (B) (33)
is smaller during the first steps of the algorithm and, hence, 2 +1
E is smaller. The learning rate η is not significantly affected
V = |V − Vtrue | (34)
by the perturbation in the initial estimation of the ellipsoid,
λ = |λ − λtrue | (35)
which indicates that the algorithm takes steps of similar size.
θ = mediani∈{1,2,3} v
i vtrue,i (36)
Hence, the result of the iterative procedure is not degraded
under perturbations of the initial ellipsoid parameter estima- where the norm · in (31) stands for the Euclidean norm
tions. of a vector, the norm · in (32) stands for the 2-norm of a
The second experiment with synthetic data comprises a set matrix, λ indicates the principal eigenvalue of B in (35) and
of repeated simulation tests to compare the performance of vi is the eigenvector associated to the i-th largest eigenvalue
the competing approaches. In order to carry out quantitative in (36).
comparisons with the competing methods, the center error Three kinds of tests with synthetic data have been consid-
(31), the distance error (32), the volume error (34), the major ered, by varying the following parameters:
axis length error (35) and the angular orientation error of the
principal axes (36) with respect to the true (ground truth) 1. The number of inlier training data points randomly drawn
ellipsoid have been computed: from the ellipsoid surface: N = 50, 100, 150, 200, 250.

123
J Math Imaging Vis (2017) 58:189–210 199

ours direct koopmans


Training samples Training samples Training samples
True ellipsoid True ellipsoid True ellipsoid
Our method direct koopmans
10 10 15

10
5 5

5
0 0
0

-5 -5
-5

-10 -10 -10


10 10 10
10 10 20
5 5 5
10
0 0 0 0 0
0
-5 -10 -5 -10 -5 -10

(a) (b) (c)

distance leastsquares simple


Training samples Training samples Training samples
True ellipsoid True ellipsoid True ellipsoid
distance leastsquares simple
15 10 15

10 10
5

5 5
0
0 0

-5
-5 -5

-10 -10 -10


10 10 10
5 20 10 20
5 5
0 10 10
0 0 0
-5 0 0
-10 -10 -5 -10 -5 -10

(d) (e) (f)


Fig. 7 Solutions for synthetic data with outliers. a Our method. b Direct method. c Koopmans method. d Distance method. e Least Square method.
f Simple method

Table 2 Quantitative errors for example synthetic dataset



a
B
V
λ
θ1
θ2
θ3 Runtime (s)

Ours 0.048975 0.378138 1.683371 0.011273 3.056489 3.058897 0.224226 3.109880


Direct 2.160242 15.301255 136.342838 0.136268 52.008192 56.020176 11.029736 0.103589
Koopmans 3.276190 178.247165 243.922386 6.891759 51.217157 59.683413 15.304854 0.121484
Distance 4.608043 107.567183 434.093471 4.225820 42.076599 63.587081 19.304151 0.448471
Least Square 2.206723 57.779994 289.667286 2.329665 54.819331 58.803372 14.229513 0.007271
Simple 4.208742 230.711858 311.385268 8.521828 53.669883 58.012052 13.494440 0.001149

2. Additive Gaussian noise for the inliers, with σ = 0.001, σ = 0.1 means that the standard deviation of the noise is 10%
0.005, 0.01, 0.05, 0.1. of the ellipsoid axis length in each principal direction. For an
3. Percentage of added outliers in the training data: P = 5, object of 1 meter this corresponds to a standard deviation of
10, 15, 20, 25%. the noise of 10 centimeters.
For each kind of test and value of the varying parameter,
100 simulation runs have been carried out to yield significant
Please note that the overall number of training data points
comparisons. For each simulation run, a new training dataset
M is the sum of the inlier and outlier points, i.e., M = N +
P has been randomly generated and provided as input to all the
100 N . The inlier generation process is as follows. First of all, competing algorithms. The following fixed values were used
N random samples on the unit sphere are generated. Then
as one of the parameters was varied: N = 100, σ = 0.01,
Gaussian noise is added to those samples. Finally, the unit
P = 10%.
sphere is linearly transformed to yield an ellipsoid. Therefore,

123
200 J Math Imaging Vis (2017) 58:189–210

Fig. 8 Real scanned object


with few outliers: a 3D scanned
points, b evolution of the center
as estimated by our method
60

50

40

30

20

10

0
40
20 40
0 20
0
-20
-20
-40 -40

(a) (b)
ours direct koopmans

Training samples Training samples Training samples


Our method direct koopmans

60 60 60

50 50 50

40 40 40

30 30 30

20 20 20

10 10 10

0 0 0

20 20 20
10 20 10 20 10 20
0 0 0
0 0 0
-10 -10 -10
-20 -20 -20 -20 -20 -20

(a) (b) (c)


distance leastsquares simple

Training samples Training samples Training samples


distance leastsquares simple

60 60 60

50 50 50

40 40 40

30 30 30

20 20 20

10 10 10

0 0 0

20 20 20
10 20 10 20 10 20
0 0 0
0 0 0
-10 -10 -10
-20 -20 -20 -20 -20 -20

(d) (e) (f)


Fig. 9 Solutions for scanned real object with few outliers. a Our method. b Direct method. c Koopmans method. d Distance method. e Least
Square method. f Simple method

Three rounds of simulations have been carried out, fixing metrics explained before. Also, we obtained the runtime of all
two of the parameters and varying the other. For each value methods on a desktop personal computer with a 64-bit quad-
of each varying parameter and each competing method, we core 3GHz CPU and standard hardware. All the methods are
have obtained the mean, median and quartiles over the set of implemented as MATLAB scripts, with no use of the GPU.
100 runs, and we have plotted their respective boxplots. The Figure 4 shows the comparisons among methods by vary-
performance of the competing methods has been evaluated ing the number of samples N . As shown in the figure, where
by comparison with the ground truth ellipsoid in terms of the boxplots of the runs are displayed, the center, distance matrix

123
J Math Imaging Vis (2017) 58:189–210 201

Table 3 Volume errors for the real scanned object with few outlier better behavior than the other methods, because it is the only
points one which has negative values in the logarithmic scales of the

V center, distance matrix and volume errors. Our method is less
efficient in the orientation, but it is still the best one, attaining
Ours 67,818.428852
mean errors no larger than 12o with a very small interquartile
Direct 67,978.753202
range. In Fig. 5 it can be seen that competitors have higher
Koopmans 67,905.470799 errors even at small values of σ , but when the noise raises,
Distance 67,825.003952 the differences among the methods are smaller. The order of
Least Square 68,091.613165 the methods remains the same as when the number of data
Simple 67,971.679099 samples is modified. Furthermore, the running time is not
affected by the noise.
Figure 6 depicts the results of the comparisons vary-
and volume error for our proposal are the lowest (note that ing the percentage of outliers P added to the data set. In
these figures have a logarithmic scale). It is followed by general terms, when there are more outliers, worse results
Direct, Least Squares and Simple algorithms, whose ten- are obtained. However, the precision of our method is the
dency is the same as ours, i.e., decreasing error as more best one. If there are more than 15% of added outliers, our
data samples are employed. However, Koopmans and Dis- results in the distance matrix and volume errors are close
tance methods have a different behavior, namely obtaining to the Direct, Least Squares and Simple algorithms. Nev-
worse results as N is increased. Values near to zero of the ertheless, the results of the center errors and the axis length
principal axes (length and orientation) confirm that the fit- and angular orientation, and especially their lower dispersion,
ted ellipsoid from our method is the best approximation to allow concluding that our method is the best performing one.
the true ellipsoid. Overall it can be observed that our errors Regarding the median in Fig. 6 it can be seen that competitors
are almost always lower than those of the other methods have an error of more than 102 in the volume and also the
and decrease when more data points are employed, which distance matrix with respect to the true ellipsoid. The center
indicates convergence to the real ellipsoid. Also, outliers are and the first principal axis length are also very different. The
almost absent in the performance results, while the mean and huge interquartile range in the boxplots of the angular orien-
median, which are displayed as an horizontal line and a cir- tation reveals that the rest of the methods are very imprecise
cle, respectively, have almost the same value, indicating a when compared with our approach. Again our execution time
high degree of robustness. This does not happen in the Dis- is slower, around 3 seconds, which is the same as in the other
tance, Koopmans or Simple algorithms. The best results in tests.
the execution time are achieved by Direct and Least squares In order to provide a qualitative assessment of the results
methods, but they are less stable. Our algorithm is not signif- with synthetic data, Fig. 7 depicts an example of the results of
icantly affected in its complexity by random data variations, the competing methods for a given synthetic dataset. It cor-
i.e., its runtime is stable across simulation runs for a given responds to N = 100 samples, percentage of added outlier
training set size. data P = 10%, and Gaussian noise level for inliers σ = 0.01.
Figure 5 shows the comparisons varying the Gaussian The associated quantitative performance metrics are shown
noise level σ for the inlier data points. At low noise lev- in Table 2. As seen, our method clearly outperforms all its
els, although the data are more dispersed, our approach has a competitors.

Fig. 10 First real scanned


object with many outlier points:
a 3D scanned points, b 80
evolution of the center as
estimated by our method 60

40

20

0
50
40
20
0 0
-20
-40
-50 -60

(a) (b)

123
202 J Math Imaging Vis (2017) 58:189–210

ours direct koopmans

Training samples Training samples Training samples


Our method direct koopmans

60 60 60

40 40 40

20 20 20

0 0 0

-20 -20 -20


40 40 40
20 20 20 20 20 20
0 0 0 0 0 0
-20 -20 -20 -20 -20 -20
-40 -40 -40
-40 -40 -40

(a) (b) (c)

distance leastsquares simple

Training samples Training samples Training samples


distance leastsquares simple

60 60 60

40 40 40

20 20 20

0 0 0

-20 -20 -20


40 40 40
20 20 20 20 20 20
0 0 0 0 0 0
-20 -20 -20 -20 -20 -20
-40 -40 -40
-40 -40 -40

(d) (e) (f)


Fig. 11 Solutions for the first real scanned object with many outliers. a Our method. b Direct method. c Koopmans method. d Distance method.
e Least Square method. f Simple method

Table 4 Volume errors for the first real scanned object with many out- respect to the volume error (34) because the scanner only
lier points provides the true volume of the scanned object, while the

V true center and the true distance matrix are unknown.
Three pieces of meal with near ellipsoidal shapes have
Ours 65,659.271694
been chosen for these experiments, one with few outliers
Direct 115,980.693801
and two with many outliers and significant occlusion. As it is
Koopmans 1,316,316.681929 shown in Fig. 8 we chose an egg as a 3D object with few out-
Distance 2,065,415.137695 lier points. Results are quite similar without any significant
Least Square 166,113.326337 differences among the applied methods, as seen in Fig. 9.
Simple 123,889.885783 In Table 3 the volume error among the studied methods is
shown. Again, no significant differences are noticed.
Another experiment to compare these methods is based on
scanning a 3D object with many outlier points and a signifi-
4.2 Scanner Data
cant occluded section. In Fig. 10, a real object is shown with
a dense cloud of outlier points. Figure 11 shows the fitting
The second round of experiments considers real objects
result of the different methods. The robustness of our method
analyzed by a 3D scanner. The real data used for these exper-
is displayed in Fig. 11a. Table 4 reports the comparison of the
iments have been acquired by using the Roland LPX 1200
volume errors using these real data with many outliers. Our
3D laser Picza™ scanner with the following characteristics:
approach is shown to consistently outperform its competitors
noncontact laser sensor, spot-beam triangulation scanning
both in qualitative and quantitative terms.
method, repeat accuracy of ±0.05 mm and laser wavelength
As the last real dataset a scanned piece of fruit with many
from 645 to 660 nm. It must be highlighted that the quan-
outlier points and occlusion has been tested (see Fig. 12).
titative comparisons for real objects can only be done with

123
J Math Imaging Vis (2017) 58:189–210 203

Fig. 12 Second real scanned


object with many outlier points:
a 3D scanned points, b 80
evolution of the center as
estimated by our method 60

40

20

0
40
20 20
0
0 -20
-20 -40
-60
-40 -80
(a)
(b)

Table 5 Volume errors for the second real scanned object with many and Gaussian filter size 5 × 5. Then stereo point pairs were
outlier points identified by the Kanade-Lucas-Tomasi (KLT) algorithm

V [42], with the maximum threshold on the forward–backward
error set to 1, and 5 pyramid levels. The stereo pairs were
Ours 90,409.475127
located on the intrinsic 3D coordinate system of the cam-
Direct 144,565.170593
era by triangulation, and finally the resulting 3D data points
Koopmans 161,886.876864 were provided to the competing ellipsoid fitting algorithms.
Distance 171,374.993323 After the estimated ellipsoids were computed, they were
Least Square 173,355.609190 backprojected to both the left and right images for visual
Simple 154,104.187763 assessment. For a better comparison, we have only con-
sidered the two methods that have the best performance in
addition to the proposed one, namely the Direct and Simple
In Table 5 the ellipsoid fitting volume error comparison is methods.
shown, which reveals that our method’s estimated volume Figure 14 shows a tridimensional reconstruction of a bas-
is much closer to the real one than those of the competing ketball and the adjustment of each method. The Direct and
approaches. Finally, Fig. 13 shows the qualitative results. Simple methods obtain an ellipsoid with a similar shape to
Once again, our method attains a close approximation to the the basketball, but underestimate the dimensions. This can be
real ellipsoid. better appreciated in Fig. 15, where the ellipsoids are super-
imposed on the right stereo image. Our fitted ellipsoid covers
4.3 Stereo Camera Data most of the ball and is centered, which means that our method
is less affected by the outliers on the right side of Fig. 14,
The third round of experiments deals with stereo image pairs while the other methods yield displaced and more stretched
acquired by a calibrated stereo camera, so that the fitted ellip- ellipsoids.
soids can be superimposed on the acquired RGB images. Figure 16 shows a tridimensional reconstruction of a
These experiments are challenging since about one half of all loquat and the adjustment of each method. The three meth-
objects are not visible, i.e., approximately 50% of the object ods obtain ellipsoids of almost the same size, but our method
surfaces are missing from the input data sets. The camera yields a better estimation of the orientation. Figure 17 depict
employed for these experiments is a JVC GS TD1™. First the superimposition on the right stereo image. There it can be
of all, the camera was calibrated by Zhang’s method [78] seen that our method produces an ellipsoid with the same ori-
to obtain the intrinsic camera parameters. Backprojection entation as the loquat, while the others are slightly displaced
errors lower than 0.5 pixels were attained. After that pairs to the right due to the presence of outliers.
of images were taken of approximately ellipsoidal objects Figure 18 shows a tridimensional reconstruction of a
on a neutral background. The images had 1920 × 1024 balloon and the adjustment of each method. Although
pixel resolution and 8 bit precision for each RGB chan- Koopmans, Least Squares and Distance algorithms are not
nel. For each image pair, feature points were searched in displayed here, they obtain larger ellipsoids. This might be
the left and right rectified images by the minimum eigen- caused by the irregular shape of the balloon, which has two
value algorithm [60], with minimum quality parameter 0.001 protuberances on the right side. Direct and Simple methods

123
204 J Math Imaging Vis (2017) 58:189–210

ours direct koopmans

Training samples Training samples Training samples


Our method direct koopmans
80 80 80

60 60 60

40 40 40

20 20 20

0 0 0
40 40 40
20 50 20 50 20 50
0 0 0 0 0 0
-20 -50 -20 -50 -20 -50
-40 -100 -40 -100 -40 -100

(a) (b) (c)

distance leastsquares simple

Training samples Training samples Training samples


distance leastsquares simple
80 80 80

60 60 60

40 40 40

20 20 20

0 0 0
40 40 40
20 50 20 50 20 50
0 0 0 0 0 0
-20 -50 -20 -50 -20 -50
-40 -100 -40 -100 -40 -100

(d) (e) (f)


Fig. 13 Solutions for the second real scanned object with many outliers. a Our method. b Direct method. c Koopmans method. d Distance method.
e Least Square method. f Simple method

4 4 4
10 10 10
2 2 2
z-axis

z-axis

z-axis

1.5 1.5 1.5

1 1 1

3000 3000 3000

2000 2000 2000


y-axis

y-axis

y-axis

1000 1000 1000

0 0 0

-1000 -1000 -1000


12 12 12
-2000 -2000 -2000
-2000 -1000 -2000 -1000 -2000 -1000
0 0 0
1000 1000 1000
2000 2000 2000
x-axis x-axis x-axis

(a) (b) (c)


Fig. 14 Solutions for our method and Direct and Simple methods using a 3D stereo reconstruction of a basketball with some outliers. The position
of the left lens is marked as ‘1’, and the right lens is marked as ‘2’. a Our method. b Direct method. c Simple method

123
J Math Imaging Vis (2017) 58:189–210 205

200 200 200

400 400 400

600 600 600

800 800 800

1000 1000 1000

500 1000 1500 500 1000 1500 500 1000 1500

(a) (b) (c)


Fig. 15 Projections on the right image of basketball of the solutions for our method and Direct and Simple methods. a Our method. b Direct
method. c Simple method

4 4 4
10 10 10

2 2 2

1.5 1.5 1.5


z-axis

z-axis

z-axis
1 1 1

0.5 0.5 0.5


4000 4000 4000
0 0 0
2000 12 2000 2000 12 2000 2000 12 2000
0 0 0
-2000 0 y-axis -2000 0 y-axis -2000 0 y-axis
x-axis -4000 x-axis -4000 x-axis -4000

(a) (b) (c)


Fig. 16 Solutions for our method and Direct and Simple methods using a 3D stereo reconstruction of a loquat with some outliers. The position of
the left lens is marked as ‘1’, and the right lens is marked as ‘2’. a Our method. b Direct method. c Simple method

200 200 200

400 400 400

600 600 600

800 800 800

1000 1000 1000

500 1000 1500 500 1000 1500 500 1000 1500

(a) (b) (c)


Fig. 17 Projections on the right image of a loquat of the solutions for our method and Direct and Simple methods. a Our method. b Direct method.
c Simple method

123
206 J Math Imaging Vis (2017) 58:189–210

12000 12000 12000

10000 10000 10000


z-axis

z-axis

z-axis
8000 8000 8000

6000 6000 6000


-1000 -1000 -1000

-500 -500 -500

0 0 0
y-axis

y-axis

y-axis
500 500 500

1000 1000 1000


2 1 3000 2 1 3000 2 1 3000
1500 1500 1500
2000 2000 2000
1000 1000 1000
2000 0 2000 0 2000 0
-1000 x-axis -1000 x-axis -1000 x-axis

(a) (b) (c)


Fig. 18 Solutions for our method and Direct and Simple methods using a 3D reconstruction of a balloon with some outliers. The position of the
left lens is marked as ‘1’, and the right lens is marked as ‘2’. a Our method. b Direct method. c Simple method

200 200 200

400 400 400

600 600 600

800 800 800

1000 1000 1000

500 1000 1500 500 1000 1500 500 1000 1500

(a) (b) (c)


Fig. 19 Projections on the right image of a balloon of the solutions for our method and Direct and Simple methods. a Our method. b Direct method.
c Simple method

obtain better results, but they are affected by the presence Algebraic criteria lead to efficient algorithms to the fit-
of outliers (lower part of the image), which causes a dis- ting problem but their accuracy can be unacceptable in the
placement of the estimated ellipsoid. However, this does not presence of outliers. On the other hand, traditional geomet-
happen with our algorithm. Figure 19 shows the superimposi- ric criteria that are used in fitting an ellipsoid are based
tion on the right stereo image. It can be seen that our method on a differentiable objective function. They give fast iter-
produces the best fit. Direct and Simple yield a displaced ative algorithms based on gradients or second derivatives,
center, which it does not occur for our proposal. using nonlinear programming methods. However, these cri-
teria could be very sensitive to outliers or data noise.
Experimental results show that our algorithm is robust
5 Conclusions since the solutions have a low sensitivity to outliers and occlu-
sion. The robustness of the proposed algorithm is due to the
In this paper, we have developed an algorithm to fit an usage of absolute rather than squared errors, since the sum
ellipsoid to a set of points by minimizing the mean abso- of absolute errors is more robust than the sum of squared
lute deviation from the level set which defines the ellipsoid errors. Furthermore, the adaptive step control procedure uses
surface. This objective function presents more robust fit the median of the last observed absolute errors; as it is well
results than other compared methods. The proposed algo- known the median is a robust estimator. Finally, the solution
rithm requires an iterative search using a positive definite ellipsoid attains a balance among the outside points and the
distance matrix to fit the feature. Nevertheless, independently inside points. These algorithm features are responsible for its
of the chosen initial parameters the proposed algorithm con- robustness against outliers and occlusion. As seen in the sim-
verges to a finite solution. ulation tests with synthetic data, our approach consistently

123
J Math Imaging Vis (2017) 58:189–210 207

outperforms its competitors in all performance metrics, with 7. Chenouri, S., Liang, J., Small, C.: Robust dimension reduction.
the exception of the runtime, where our algorithm is slower. Wiley Interdiscip. Rev.: Comput. Stat. 7(1), 63–69 (2015)
8. Chernov, N., Lesort, C.: Least squares fitting of circles. J. Math.
Also, a substantially smaller dispersion in the performance Imaging Vis. 23(3), 239–252 (2005)
results are found for our method, which indicates that our 9. Chung, P., Ng, G.: Comparison between an accelerometer and
approach is more reliable. The experiments with real data a three-dimensional motion analysis system for the detection of
from a 3D scanner and a stereo camera confirm the results movement. Physiotherapy 98(3), 256–259 (2012). Special Issue
on Advancing Technology including papers from WCPT
obtained for synthetic data, even for objects with significant 10. Collings, S., Kozera, R., Noakes, L.: Robust surface fitting from
occlusion. two views using restricted correspondence. J. Math. Imaging Vis.
Some of the main computational advantages of proposed 34(2), 200–221 (2009)
algorithm are that the objective function usually decreases at 11. Comport, A., Marchand, E., Pressigout, M., Chaumette, F.: Real-
time markerless tracking for augmented reality: the virtual visual
each iteration because it uses an adaptive step, the number of
servoing framework. IEEE Trans. Vis. Comput. Graph. 12(4), 615–
iterations is usually reduced, and the operations performed 628 (2006)
by the algorithm are mainly based on the sum of the abso- 12. Cross, G., Zisserman, A.: Quadric reconstruction from dual-space
lute errors coming from the distances from each point to the geometry. In: Sixth International Conference on Computer Vision,
1998, pp. 25–31 (1998)
center. 13. Daubechies, I., Devore, R., Fornasier, M., Güntürk, C.: Iteratively
Therefore, it can be concluded that a competitive approach reweighted least squares minimization for sparse recovery. Com-
for ellipsoid fitting has been proposed, which can be used for mun. Pure Appl. Math. 63(1), 1–38 (2010)
datasets with significant amounts of outliers and occlusion. 14. Eberly, D.: Geometric Tools, LLC. http://www.geometrictools.
com
This enhances its applicability to real problems with low 15. Fang, J., Liu, Z.: A new inclination error calibration method of
quality input data. motion table based on accelerometers. IEEE Trans. Instrumen.
Meas. 64(2), 487–493 (2015)
Acknowledgements This work is partially supported by the Ministry 16. Fang, J., Sun, H., Cao, J., Zhang, X., Tao, Y.: A novel calibration
of Economy and Competitiveness of Spain under Grant TIN2014- method of magnetic compass based on ellipsoid fitting. IEEE Trans.
53465-R, project name Video surveillance by active search of anoma- Instrum. Meas. 60(6), 2053–2061 (2011)
lous events. It is also partially supported by the Autonomous Gov- 17. Figueiredo, M., Bioucas-Dias, J., Nowak, R.: Majorization–
ernment of Andalusia (Spain) under projects TIC-6213, project name minimization algorithms for wavelet-based image restoration.
Development of Self-Organizing Neural Networks for Information IEEE Trans. Image Process. 16(12), 2980–2991 (2007)
Technologies; and TIC-657, project name Self-organizing systems and 18. Fitzgibbon, A., Pilu, A., Fisher, R.: Direct least square fitting of
robust estimators for video surveillance. All of them include funds ellipses. IEEE Trans. Pattern Anal. Mach. Intell. 21(5), 476–480
from the European Regional Development Fund (ERDF). The authors (1999)
thankfully acknowledge the computer resources, technical expertise and 19. Flöry, S., Hofer, M.: Surface fitting and registration of point clouds
assistance provided by the SCBI (Supercomputing and Bioinformatics) using approximations of the unsigned distance function. Comput.
center of the University of Málaga. They have also been supported by the Aided Geom. Des. 27(1), 60–77 (2010)
Biomedic Research Institute of Málaga (IBIMA). They also gratefully 20. Gander, W., Golub, G.H., Strebel, R.: Least-squares fitting of cir-
acknowledge the support of NVIDIA Corporation with the donation cles and ellipses. BIT Numer. Math. 34(4), 558–578 (1994)
of the Titan X GPU used for this research. Karl Thurnhofer-Hemsi is 21. Gang, Y., Yingtang, Z., Hongbo, F., GuoQuan, R., Zhining, L.:
funded by a Ph.D. scholarship from the Spanish Ministry of Education, Integrated calibration of magnetic gradient tensor system. J. Magn.
Culture and Sport under the FPU program. Magn. Mater. 374, 289–297 (2015)
22. Ge, Z., S, B., Chan, H.P., Hadjiiski, L.M., Cascade, P.N., Bogot, N.,
Zhou, C.: Computer-aided detection of lung nodules: false positive
reduction using a 3D gradient field method and 3d ellipsoid fitting.
References Robot. Auton. Syst. 8(32), 2443–2454 (2005)
23. Gietzelt, M., Wolf, K.H., Marschollek, M., Haux, R.: Performance
1. Ahn, S.J.: 3. Orthogonal distance fitting of implicit curves and comparison of accelerometer calibration algorithms based on 3D-
surfaces. In: Least Squares Orthogonal Distance Fitting of Curves ellipsoid fitting methods. Comput. Methods Progr. Biomed. 111(1),
and Surfaces in Space, Lecture Notes in Computer Science, vol. 62–71 (2013)
3151, pp. 35–53. Springer, Berlin (2004) 24. Gonzalez-Villanueva, L., Cagnoni, S., Ascari, L.: Design of a wear-
2. Blane, M., Lei, Z., Civi, H., Cooper, D.: The 3L algorithm for able sensing system for human motion monitoring in physical
fitting implicit polynomial curves and surfaces to data. IEEE Trans. rehabilitation. Sensors 13(6), 7735 (2013)
Pattern Anal. Mach. Intell. 22(3), 298–313 (2000) 25. Gotardo, P., Bellon, O., Boyer, K., Silva, L.: Range image segmen-
3. Branham Jr., R.L.: Alternatives to least squares. Astron. J. 87, 928– tation into planar and quadric surfaces using an improved robust
937 (1982) estimator and genetic algorithm. IEEE Trans. Syst. Man Cybern.
4. Calafiore, G.: Approximation of n-dimensional data using spherical B: Cybern. 34(6), 2303–2316 (2004)
and ellipsoidal primitives. IEEE Trans. Syst. Man Cybern. A: Syst. 26. Grammalidis, N., Strintzis, M.: Head detection and tracking by 2D
Hum. 32(2), 269–278 (2002) and 3D ellipsoid fitting. In: Proceedings of the Computer Graphics
5. Cao, X., Shrikhande, N.: Quadric surface fitting for sparse range International, 2000, pp. 221–226 (2000)
data. In: Decision Aiding for Complex Systems, Conference Pro- 27. Grivon, D., Vezzetti, E., Violante, M.G.: Development of an inno-
ceedings of the 1991 IEEE International Conference on Systems, vative low-cost MARG sensors alignment and distortion compen-
Man, and Cybernetics, 1991, vol. 1, pp. 123–128 (1991) sation methodology for 3D scanning applications. Robot. Auton.
6. Chen, Y., Liu, C.: Quadric surface extraction using genetic algo- Syst. 61(12), 1710–1716 (2013)
rithms. Comput. Aided Des. 31(2), 101–110 (1999)

123
208 J Math Imaging Vis (2017) 58:189–210

28. Harris, J.W., Stocker, H.: Handbook of Mathematics and compu- 48. Misztal, K., Tabor, J.: Ellipticity and circularity measuring via
tational Science. Springer, Berlin (1998) Kullback–Leibler divergence. J. Math. Imaging Vis. 55(1),136–
29. He, R., Hu, B.G., Zheng, W.S., Kong, X.W.: Robust principal com- 150 (2015)
ponent analysis based on maximum correntropy criterion. IEEE 49. Muñoz-Pérez, J., de Cózar-Macías, O., Blázquez-Parra, E., Ladrón
Trans. Image Process. 20(6), 1485–1494 (2011) de Guevara-López, I.: Multicriteria robust fitting of elliptical prim-
30. Helzer, A., Barzohar, M., Malah, D.: Stable fitting of 2D curves and itives. J. Math. Imaging Vis. 49(2), 492–509 (2014)
3D surfaces by implicit polynomials. IEEE Trans. Pattern Anal. 50. Olivares, A., Ruiz-Garcia, G., Olivares, G., Górriz, J.M., Ramirez,
Mach. Intell. 26(10), 1283–1294 (2004) J.: Automatic determination of validity of input data used in ellip-
31. Huber, P.: Robust Statistics. Wiley, New York (1981) soid fitting marg calibration algorithms. Sensors 13(9), 11,797
32. Hunyadi, L., Vajk, I.: Constrained quadratic errors-in-variables fit- (2013)
ting. Vis. Comput. 30, 1347–1358 (2014) 51. Oliveira, J., Bioucas-Dias, J., Figueiredo, M.: Adaptive total vari-
33. Karnesky, R.A., Sudbrack, C.K., Seidman, D.N.: Best-fit ellipsoids ation image deblurring: a majorization–minimization approach.
of atom-probe tomographic data to study coalescence of γ (L 12 ) Signal Process. 89(9), 1683–1693 (2009)
precipitates in Ni–Al–Cr. Scr. Mater. 57(4), 353–356 (2007) 52. Park, S.K., Suh, Y.S.: A zero velocity detection algorithm using
34. Keren, D., Cooper, D., Subrahmonia, J.: Describing complicated inertial sensors for pedestrian navigation systems. Sensors 10(10),
objects by implicit polynomials. IEEE Trans. Pattern Anal. Mach. 9163 (2010)
Intell. 16(1), 38–53 (1994) 53. Pratt, V.: Direct least-squares fitting of algebraic surfaces. SIG-
35. Keren, D., Gotsman, C.: Fitting curves and surfaces with con- GRAPH Comput. Graph. 21(4), 145–152 (1987)
strained implicit polynomials. IEEE Trans. Pattern Anal. Mach. 54. Rimon, E., Boyd, S.: Obstacle collision detection using best ellip-
Intell. 21(1), 31–41 (1999) soid fit. J. Intell. Robot. Syst. 18(2), 105–126 (1997)
36. Krach, B., Robertson, P.: Integration of foot-mounted inertial 55. Rousseeuw, P., Leroy, A.: Robust Regression and Outlier Detection.
sensors into a bayesian location estimation framework. In: 5th Wiley, New York (1987)
Workshop on Positioning, Navigation and Communication, 2008 56. Sahin, T., Unel, M.: Stable algebraic surfaces for 3d object repre-
(WPNC 2008), pp. 55–61 (2008) sentation. J. Math. Imaging Vis. 32(2), 127–137 (2008)
37. Kubota, T., Okada, K.: Estimating diameters of pulmonary nod- 57. Sappa, A., Rouhani, M.: Efficient distance estimation for fitting
ules with competition–diffusion and robust ellipsoid fit. In: Liu, Y., implicit quadric surfaces. In: 2009 16th IEEE International Con-
Jiang, T., Zhang, C. (eds.) Computer Vision for Biomedical Image ference on Image Processing (ICIP), pp. 3521–3524 (2009)
Applications, Lecture Notes in Computer Science, vol. 3765, pp. 58. Sarakon, P., Charoenpong, T., Charoensiriwath, S.: Nose tip detec-
324–334. Springer, Berlin (2005) tion using ellipsoid fitting for 2.5D partial face data. In: 2013 6th
38. Ladrón de Guevara, I., Muñoz, J., Cózar, O.D., Blázquez, E.B.: Biomedical Engineering International Conference (BMEiCON),
Robust fitting of circle arcs. J. Math. Imaging Vis. 40(2), 147–161 pp. 1–5 (2013)
(2010) 59. Sarakon, P., Charoenpong, T., Charoensiriwath, S.: Face shape
39. Lee, P.Y., Moore, J.: Geometric optimization for 3D pose estima- classification from 3D human data by using SVM. In: 2014 7th
tion of quadratic surfaces. In: Conference Record of the Thirty- Biomedical Engineering International Conference (BMEiCON),
Eighth Asilomar Conference on Signals, Systems and Computers, pp. 1–5 (2014)
2004, vol. 1, pp. 131–135 (2004) 60. Shi, J., Tomasi, C.: Good features to track. In: Proceedings of the
40. Li, Q., Griffiths, J.: Least squares ellipsoid specific fitting. In: Pro- IEEE Computer Society Conference on Computer Vision and Pat-
ceedings of the Geometric Modeling and Processing, 2004, pp. tern Recognition, pp. 593–600 (1994)
335–340 (2004) 61. Skog, I., Nilsson, J.O., Handel, P.: Evaluation of zero-velocity
41. Lou, X., Zhou, L., Jia, Y.: Realization of ellipsoid fitting calibration detectors for foot-mounted inertial navigation systems. In: 2010
for three-axis magnetic sensor based on stm32 embedded system. International Conference on Indoor Positioning and Indoor Navi-
In: Zu, Q., Hu, B., Gu, N., Seng, S. (eds.) Human Centered Comput- gation (IPIN), pp. 1–6 (2010)
ing, Lecture Notes in Computer Science, vol. 8944, pp. 717–726. 62. Sturm, P., Gargallo, P.: Conic fitting using the geometric distance.
Springer, Berlin (2015) In: Yagi, Y., Kang, S., Kweon, I., Zha, H. (eds.) Computer Vision—
42. Lucas, B.D., Kanade, T.: An iterative image registration technique ACCV 2007, Lecture Notes in Computer Science, vol. 4844, pp.
with an application to stereo vision. In: Proceedings of the 7th 784–795. Springer, Berlin (2007)
International Joint Conference on Artificial Intelligence, vol. 2, 63. Sullivan, S., Sandford, L., Ponce, J.: Using geometric distance fits
pp. 674–679. Morgan Kaufmann, San Francisco, CA, USA (1981) for 3D object modeling and recognition. IEEE Trans. Pattern Anal.
43. Lukacs, G., Martin, R., Marshall, D.: Faithful least-squares fitting Mach. Intell. 16(12), 1183–1196 (1994)
of spheres, cylinders, cones and tori for reliable segmentation. In: 64. Susi, M., Renaudin, V., Lachapelle, G.: Motion mode recogni-
Burkhardt, H., Neumann, B. (eds.) Computer Vision—ECCV’98, tion and step detection algorithms for mobile phone users. Sensors
Lecture Notes in Computer Science, vol. 1406, pp. 671–686. 13(2), 1539 (2013)
Springer, Berlin (1998) 65. Szpak, Z.L., Chojnacki, W., Hengel, A.: Guaranteed ellipse fitting
44. Mahdavi, S., Salcudean, S.: 3D prostate segmentation based on with a confidence region and an uncertainty measure for centre,
ellipsoid fitting, image tapering and warping. In: 30th Annual Inter- axes, and orientation. J. Math. Imaging Vis. 52(2), 173–199 (2014)
national Conference of the IEEE Engineering in Medicine and 66. Taubin, G.: Estimation of planar curves, surfaces, and nonplanar
Biology Society, 2008 (EMBS 2008), pp. 2988–2991 (2008) space curves defined by implicit equations with applications to edge
45. Malyugina, A., Igudesma, K., Chickrin, D.: Least-squares fitting and range image segmentation. IEEE Trans. Pattern Anal. Mach.
of a three-dimensional ellipsoid to noisy data. Appl. Math. Sci. Intell. 13(11), 1115–1138 (1991)
8(149), 7409–7421 (2014) 67. Taubin, G., Cukierman, F., Sullivan, S., Ponce, J., Kriegman, D.:
46. Mathews, V., Xie, Z.: A stochastic gradient adaptive filter with Parameterized families of polynomials for bounded algebraic curve
gradient adaptive step size. IEEE Trans. Signal Process. 41(6), and surface fitting. IEEE Trans. Pattern Anal. Mach. Intell. 16(3),
2075–2087 (1993) 287–303 (1994)
47. Meer, P., Mintz, D., Rosenfeld, A., Kim, D.: Robust regression 68. Theekapun, C., Hase, H., Tokai, S.: Robust nose localization by
methods for computer vision: a review. Int. J. Comput. Vis. 6, 59– using fitting of ellipse from 2.5d image. In: 2006 IEEE Region 10
70 (1991) Conference on TENCON 2006, pp. 1–4 (2006)

123
J Math Imaging Vis (2017) 58:189–210 209

69. Trucco, E., Verri, A.: Introductory Techniques for 3-D Computer Óscar David de Cózar-Macías
Vision. Prentice-Hall, Upper Saddle River (1998) (born 1972) is associate pro-
70. Vajk, I., Hetthessy, J.: Identification of nonlinear errors-in-variables fessor with the Department of
models cation of nonlinear errors-in-variables models. Automatica Graphic Engineering, Design
39, 2099–2107 (2003) and Projects at the University of
71. Van Den Doel, K., Ascher, U.: The chaotic nature of faster gradient Málaga. He is Secretary of the
descent methods. J. Sci. Comput. 51(3), 560–581 (2012) Polytechnic School from 2001.
72. Vandenberghe, L., Boyd, S.: Semidefinite programming. SIAM He received his P.D. degree from
Rev. 38(1), 49–95 (1996) the University of Málaga in
73. Waibel, P., Matthes, J., Gröll, L.: Constrained ellipse fitting with December 2010, Spain. Also, he
center on a line. J. Math. Imaging Vis. 53(3), 364–382 (2015) is member of the Graphic Engi-
74. Welsch, R.: Robust regression using iteratively reweighted least- neering and Design Research
squares. Commun. Stat. Theory Methods 6(9), 813–827 (1977) Group and his research inter-
75. Ying, X., Yang, L., Zha, H.: A fast algorithm for multidimensional ests are in digital image analysis,
ellipsoid-specific fitting by minimizing a new defined vector norm visual pattern recognition, cul-
of residuals using semidefinite programming. IEEE Trans. Pattern tural and industrial heritage and product design. He is on the editorial
Anal. Mach. Intell. 34(9), 1856–1863 (2012) board of I+Disposed magazine and member of the Spanish Association
76. Yu, J., Kulkarni, S.R., Poor, H.V.: Robust fitting of ellipses and of Graphics Engineering.
spheroids. In: Proceedings of the 43rd Asilomar Conference on
Signals, Systems and Computers, pp. 94–98. IEEE Press (2009) Elidia Beatriz Blázquez-Parra
77. Yu, K., Dang, X., Chen, Y.: Robustness of the affine equivariant (born 1974) is an assistant
scatter estimator based on the spatial rank covariance matrix. Com- professor with the Department
mun. Stat. Theory Methods 44(5), 914–932 (2015) of Graphic Engineering, Design
78. Zhang, Z.: A flexible new technique for camera calibration. IEEE and Projects at the University of
Trans. Pattern Anal. Mach. Intell. 22(11), 1330–1334 (2000) Málaga. She received her P.D.
79. Zhi-qiang, Z., Guang-Zhong, Y.: Micromagnetometer calibration degree in Geodesy and Carto-
for accurate orientation estimation. IEEE Trans. Biomed. Eng. graphic Engineering in Septem-
62(2), 553–560 (2015) ber 2003 from the University
of Jaén, Spain. She is a mem-
ber of the Graphic Engineering
Research Group and her research
Ezequiel López-Rubio (born interests are in Geodesy, GPS and
1976) received his M.Sc. and geographical information sys-
Ph.D. (honors) degrees in Com- tems. Her current research activ-
puter Engineering from the Uni- ities include digital image analysis and visual pattern recognition. She is
versity of Málaga, Spain, in on the editorial board of I+Disposed magazine and also on the scientific
1999 and 2002, respectively. He committee of Topografía y Cartografía journal.
joined the Department of Com-
puter Languages and Computer
Science, University of Málaga, José Muñoz-Pérez (born 1952)
in 2000, where he is currently received his M.Sc. in Mathe-
an Associate Professor of Com- matics from the University of
puter Science and Artificial Intel- Granada, Spain, in 1974; and
ligence. His technical interests his Ph.D. degree in Mathemat-
are in machine learning, pattern ics from the University of Seville,
recognition and image process- Spain, in 1978. He joined the
ing. University of Málaga in 1974,
and then moved to the Univer-
sity of Seville in 1976. Finally he
Karl Thurnhofer-Hemsi (born joined the Department of Com-
1990) received his B.Sc. in Com- puter Languages and Computer
puter Engineering and his M.Sc. Science, University of Málaga, in
in Mathematics degrees from the 1989, where he is currently a full
University of Málaga, Spain, in Professor of Computer Science
2014. He joined the Medical and and Artificial Intelligence. His technical interests are in computational
Health Research Center of the statistics, neural networks and image processing.
University of Málaga in 2015.
He is currently a Ph.D. candidate
at the Department of Computer
Languages and Computer Sci-
ence, University of Málaga. His
technical interests are in medical
image analysis, pattern recogni-
tion and image processing.

123
210 J Math Imaging Vis (2017) 58:189–210

Isidro Ladrón de Guevara-


López (born 1952) received his
P.D. degree in Industrial Engi-
neering in May 1998 from the
University of Málaga. He is head
of the Graphical Engineering
Research Group, and the direc-
tor of the Department of Graphic
Engineering, Design and Project
of Málaga University. He works
on the design process and prod-
ucts development taking out sev-
eral patents, and he is author of
a number of engineering drawing
books. He has published over 30
papers in internationally reputed congress and has participated in differ-
ent Spanish projects of R+D with governments and private companies.
His research activity is also carried out with new researchers and he has
been the advisor of six Ph.D. as well as supervisor of over fifteen. At
last he is on scientific committee of I+Disposed magazine.

123

You might also like