order to reduce this number, one can drop pixels hav-
ing small gradient components since they do not have
a heavy impact on the whole accuracy of the solution.
In the sequel, we do not distinguish between the two
cases. By inserting Eqs.(4) and (5) into Eq.(3) we get
I
x
a
1
+ I
x
x a
2
+ I
x
y a
3
+ I
y
a
4
+ I
y
x a
5
+ I
y
y a
6
+(I
x
x
2
+ I
y
x y) a
7
+ (I
x
x y + I
y
y
2
) a
8
= −I
t
(7)
By concatenating the above equation for all pixels,
we get an over-constrained linear system having the
following form:
Ga = e (8)
where a denotes the column vector
(a
1
, a
2
, a
3
, a
4
, a
5
, a
6
, a
7
, a
8
)
T
.
It is well known that the Maximum Likelihood so-
lution to the above linear system is given by:
a = G
†
e (9)
where G
†
= (G
T
G)
−1
G
T
is the pseudo-inverse of
the N × 8 matrix G. This solution is known as the
Least Square solution (LS). The above solution is
only optimal in the case where the linear system is
corrupted by Gaussian noise with a fixed variance.
In practice, the system of linear equations may con-
tain outliers. In other words, there are some pixels
for which the residual of Eq.(3) is very large and can
affect the solution. These outliers can be caused by
local planar excursions and derivatives errors. There-
fore, our idea is to estimate the 8 coefficients using
robust statistics (Huber, 2003). We proceed as fol-
lows. First, equations are explored using subsamples
of p linear equations (remember that each linear equa-
tion in (8) is provided by a pixel). For the problem at
hand, p should be at least eight. Second, the solution
is chosen according to the consensus measure based
on residual errors. A Monte Carlo type technique
is used to draw K random subsamples of p different
equations/pixels. Figure 2 illustrates the algorithm.
Detecting inliers The question now is: Given a sub-
sample k and its associated solution a
k
, How do we
decide whether or not a pixel is an inlier? In tech-
niques dealing with geometrical features (points and
lines) (Fischler and Bolles, 1981), this can be easily
achieved using the distance in the image plane be-
tween the actual location of the feature and its mapped
location. If this distance is below a given threshold
then this feature is considered as an inlier; otherwise,
it is considered as an outlier.
In our case, however, there are no geometrical fea-
tures at all since only image derivatives are used.
Therefore, our idea is to compute a robust estimation
of standard deviation of the residual errors. In the ex-
ploration step, for each subsample k, the median of
residuals was computed. If we denote by
M the least
Random sampling: Repeat the following three steps
K times
1. Draw a random subsample of p different equa-
tions/pixels.
2. For this subsample, indexed by k, compute the eight co-
efficients, i.e. the vector a
k
, from the corresponding p
equations using a linear system similar to (8).
3. For this solution a
k
, determine the median M
k
of the
squared residuals with respect to the whole set of N
equations. Note that we have N residuals correspond-
ing to the linear system (8).
Consensus step:
1. For each solution a
k
, k = 1, . . . , K, compute the num-
ber of inliers among the entire set of equations/pixels (see
below). Let n
k
be this number.
2. Choose the solution that has the highest number
of inliers. Let a
i
be this solution where i =
arg max
k
(n
k
), k = 1, . . . , K
3. Refine a
i
using the system formed by its inliers, that is,
(9) is used without the outliers.
Figure 2: Recovering the eight coefficients using robust sta-
tistics.
median, then a robust estimation of the standard de-
viation of the residual is given by (Rousseeuw and
Leroy, 1987):
ˆσ = 1.4826
1 +
5
N − p
p
M (10)
Once ˆσ is known, any pixel j can be considered as
an inlier if its residual error satisfies |r
j
| < 3 ˆσ.
The number of subsamples K A subsample is
“good” if it consists of p good pixels. The number
of subsamples is chosen such that the probability P
r
that at least one of the K subsamples is good is very
close to one (e.g., P
r
= 0.98). Assuming that the
whole set of equations may contain up to a fraction ǫ
of outliers, the probability that at least one of the K
subsamples is good is given by
P
r
= 1 − [1 − (1 −ǫ)
p
]
K
Given a prior knowledge about the percentage of out-
liers ǫ the corresponding K can be computed by:
K =
log (1 − P
r
)
log (1 − (1 −ǫ)
p
)
For example, when p = 20, P
r
= 0.98, and ǫ = 20%
we get K = 337 samples.
3.2 The SFM Parameters
Once the eight coefficients are recovered, it
can be shown that the SFM parameters, i.e.
SFM FOR PLANAR SCENES: A DIRECT AND ROBUST APPROACH
177