• Keine Ergebnisse gefunden

Fixed Number of Points

Im Dokument Error Propagation (Seite 77-84)

4.3 Lines

4.3.2 Fixed Number of Points

and angle and distance to the origin. It is well known that both slope as well as intercept become infinite for vertical lines (and in the case of intercept-intercept parametrisation also horizontal lines).

In addition there are a number of redundant representations for lines, using more than 2 parameters. An example already discussed in Section 2.4 is the homogeneous 3-vector (a, b, c)T. With a2 +b2 = 1 this becomes the normal form. Kanatani [69]

and others suggested a parametrisation (a, b, c/f)T with a2+b2 +c2/f2 = 1, where f is a constant of the same order of magnitude asc, often the focal length the image was taken with (compare Section 2.9), the diagonal length of the image, or some other image dimension. Note that a covariance matrix for any of these redundant representations will of course be singular.

Parametrisations particularly appropriate to line segments as measured in the image have also been developed, e. g. using a line segment’s endpoints (x1, y1, x2, y2) as cited in [140] or a line segment’s centre (mean edgel position) and angle with the x-axis, (α,x,¯ y)¯ T which I first presented in [6].

It is of course possible to convert any representation into any of the two-parameter or redundant representations, but, in general, not into the line segment representa-tions. However, these conversions, while theoretically possible, can become numer-ically problematic; one example is the conversion from and to the slope-intercept representation for near vertical lines. We will later see that some parametrisations are better suited to a certain task than others, and that in particular the angle-centre representation is well suited for the line segments commonly fitted in computer vi-sion. The next section re-visits the line-fit problem, starting from first principles.

4.3.2 Fixed Number of Points

The problem of fitting a line to a fixed number of points can be stated as follows:

given n points xi, i = 1. . . n, with distributions pxi(xi), find the line ` with distri-bution p`(`) that maximises the conditional probability

P(`|x1. . .xn) = P(x1. . .xn|`)P(`)

P(x1. . .xn) −→max

` (4.3)

where P(`|x1. . .xn) is the probability of observing the line ` given the points x1. . .xn, P(x1. . .xn|`) is the probability to observe the points x1. . .xn given `, P(`) is the line’s a-priori probability, and P(x1. . .xn) is the points’ a-priori proba-bility.

It is obvious that for any fixed set of points xi, i = 1. . . n the term P(x1. . .xn) can have no influence on which line ` maximises Equation (4.3). Also, in nearly all applications no knowledge exists about the individual lines’ a-priori probabilities

78 Lines P(`), which are therefore usually assumed constant2. This reduces Equation (4.3) to

P(`|x1. . .xn)∝P(x1. . .xn|`)−→max

` . (4.4)

If all the pointsxi,i= 1. . . nare independently distributed observations of a perfect line3, we can multiply the individual probabilities

P(x1. . .xn|`) = Yn

i=1

P(xi|`)−→max

` . (4.5)

The individual point’s probability depends on its distance from the line and its particular covariance matrix. If the point has the Euclidean coordinates (x, y)T and the line is given by its normal form we can write

xi = (xi, yi,1)T (4.6) Using Equation (3.53) the individual point’s probability is then given by

P(xi|`) = 1

Maximising Equation (4.5) is therefore equal to minimising a sum of weighted Eu-clidean distances

under the condition a2 +b2 = 1. There is, in general, no closed form solution to Equation (4.10).

A slightly different approach was presented by Kanatani [73]. Instead of min-imising Euclidean distance his approach minimises algebraic distance with vectors

` = (a, b, c/f)T and xi = (x, y, f)T under the condition k`k2 =kxik2 = 1, where f is again a constant in the order of magnitude of the focal length. This approach was later extended tof = 1 by Kanazawa and Kanatani [77]. They employ an elaborate scheme to avoid the bias which would be introduced by a naive iteration. A short description of their algorithm can be found in the following section.

2If a particular application does provide a-priori knowledge about, for example, a line’s angle, this should of course be used. However, I’ll assume that this is not the case here and, indeed, in virtually all computer vision applications that deal with projective geometry.

3This is approximately the case.

4.3.2 Fixed Number of Points 79 4.3.2.1 Iterative Solution

As mentioned before, no closed form solution exists for Equation (4.10). It might seem reasonable though to rewrite Equation (4.10) as

min` `TM` (4.11)

with M = 1

n Xn

i=1

wixixTi (4.12)

and wi = 1

`0TΣxi`0 (4.13)

and iteratively solve for `, where `0 is a previously found solution. It can, however, be shown that this approach will lead to a biased solution for`, and Kanazawa and Kanatani [77] suggested the following approach instead:

1. Let c= 0 andwi = 1, i= 1. . . n.

2. Compute the matrices M (compare Equation (4.12)) and N= 1

n Xn

i=1

wiΣxi.

3. Compute the smallest eigenvalue λ and corresponding eigenvector ` of Mˆ =M−cN.

4. If the iteration reached a stationary state (∆λ = 0, [77] uses λ ≈ 0) abort, else update c and wi as follows and return to 2

c ← c+ λ

`TN`

wi ← 1

`TΣxi`. An estimate for the line’s covariance matrix is given by

Σ` = c n−2

2 (4.14)

where ( )2 denotes the generalised inverse computed by ignoring the smallest eigen-value, which might not be exactly zero due to numerical reasons or a premature termination of the above steps [77].

It should be noted that using Equation (4.14) the line’s covariance can be calculated even if only the cofactor matrices are given for the individual points. This is based

80 Lines on aχ2 distribution with n−2 DOF. It is in this case, however, impossible to make any statement about the quality of the fit.

The algebraic distance used above can be interpreted geometrically when using the ray-space or Gaussian sphere model (Section 2.9): imagine a unit sphere touching the image in the image centre. Each point in the image corresponds to the point on the sphere where a line from the sphere’s origin to the image point intersects the sphere; each line in the image corresponds to a great circle where a plane through the origin and the original line in the image intersects the sphere. Minimising the algebraic distance finds the plane through the origin with minimum mean squared scaled orthographic distance from these points on the sphere. The intersection between this plane and the image plane is the line with minimum algebraic distance to the original points.

4.3.2.2 Direct Least Squares Solution

The iterative solution described above is comparatively slow. It would therefore be useful if some faster algorithm could be devised, preferably some closed form solu-tion, or an approximation to such a solution. In order to use a closed form solution to Equation (4.10) we need to be able to approximate the denominator by a term independent of `. For this we need to know what the individual edgels’ covariance matrices look like. Most modern edge-finders will do a sub-pixel approximation or-thogonal to the (perceived) edge direction, which might result in different variances orthogonal to (σ2) or parallel with (σ2k) the edge, but to a good approximation independent of the individual edgel itself4. The resulting covariance matrix is

Σxi = R−T

σk2 0 0 0 σ2 0

0 0 0

R−1

with R =

cos(αi) −sin(αi) 0 sin(αi) cos(αi) 0

0 0 1

where αi is the estimated angle between the edge through xi and the x-axis5. The denominator in Equation (4.10) then becomes

`TΣxi` =σi22 cos2(α−αi) +σ2ksin2(α−αi) (4.15) where α is the angle between the fitted line and the x-axis. Although, in general, α 6= αi, the difference will nonetheless be small for any reasonable edge-finder.

Figure 4.6 shows some typical histograms over the deviation from the true angle for 6 different angles 0 ≤α ≤ 125π.

4σ2andσk2might depend on the perceived edge direction, but this effect is generally sufficiently small — and constant for any single line — to be safely ignored in this application.

5It is of courseRT=R.

4.3.2 Fixed Number of Points 81

Figure 4.6: Estimated angle versus true angle for different angles. Plotted are typical histograms over the deviation from the mean for lines at approximately 0, 15, 30, 45, 60, and75.

Since the difference between the perceived angle αi and true angle α is generally well below 2, we can, with sin2(α − αi) ≤ 0.00122 and cos2(α −αi) ≥ 0.9988, approximate Equation (4.15) with

`TΣxi`≈σ22 (4.16)

which is independent ofxiand interestingly alsoσk2. This conforms with the intuition that in fitting a line to points the individual point’s position along the direction of the line (and therefore also its covariance in that direction) is of small or no consequence for the fitting process. The particular instance of the Canny edge detector [24] used throughout this thesis results in a standard deviation of 0.1 pxl ≤ σ ≤ 0.3 pxl, depending on the sensor type and image quality. This finally leads to the equation commonly minimised in orthogonal regression

min` minimised by the line ` that passes through the point

x¯ (we will call this point the line’s centre point or simply centre) and whose normal-vector is the eigennormal-vector to the matrix’s

Mxx = 1

82 Lines smaller eigenvalue λmin, where the mean squared weighted orthographic distance in Equation (4.17) corresponds to λmin.

Once the line ` has been found, it is easy to calculate its covariance matrix using Equation (3.53) for any of the representations mentioned in Section 4.3 (although the actual equations involved can get somewhat lengthy, they are easily enough created, as discussed in Section 3.3.3). Using the α, ¯x, ¯y parametrisation has the added advantage that the covariance matrix becomes to a very good approximation block-diagonal, i. e.

Σ` =

σα2 0 0 0 σ2¯x σ¯y

0 σ¯y σy2¯

 (4.20)

and as small deviations in the centre-point’s position along the line are normally of little importance this can be further approximated by a diagonal matrix with σx2¯2y¯ = n1σ2. This is in agreement with Equation (4.16) for the special case that Σx describes a circular covariance region.

However, in many cases and for many applications it might not be necessary to calculate explicitly the line’s covariance matrix using Equation (3.53). Since the edgels along a line are usually quite evenly distributed, where the distance between individual edgles depends mainly on the angle between the line and the x-axis, it is perfectly reasonable to give a rule of thumb for the covariance matrix based only on the length of the line l, the number of edgels n and the angle α. The relationship in (4.21)– (4.22) have been found experimentally, however, they are a nearly perfect representation of the true values, compare Figure 4.7.

σ2α ≈ 12σ2

n03 (4.21)

with n03 =l3 1 + 121/3−121/3max(kcos(α)k,kcos(π/2−α)k)

(4.22) σx,¯2¯y ≈ σ2

n . (4.23)

Here n0 is the equivalent number of edgels, an empirically found, purely arithmetic figure, it is usually n ≥ n0 ≥ l (unless the edgel-chain contained holes). Equa-tion (4.23) can immediately be derived from EquaEqua-tion (4.18).

Figure 4.7, which plots the linearised variance (12σ2α2)1/3 over n0, shows how well Equation (4.21) approximates the actual values for σ2α measured for 5411 fitted lines from 10 different images of various real-life street scenes. Equations (4.21)–(4.23), which have never been published before, are similar in spirit to the dependence ofσα2 on line-lengthl derived by Brillault [20] — however, her theoretical approach, which considered only the endpoint-positions as a source for errors, gives a completely different qualitative behaviour not consistent with reality. They can be used to further speed up computations while retaining the full power of error propagation.

4.3.2 Fixed Number of Points 83

0 100 200 300 400 500 600 700 800

0 100 200 300 400 500 600 700 800 PSfrag replacements

Data points Predicted points (12σ2α2)1/3

n0

Figure 4.7: σα2 as a function of l and α. The points show the linearised variance (12σ2α2)1/3 over n0 for 5411 fitted lines from 10 different images of various real-life street scenes; the steps represent the function dn0+ 0.5e

.

84 Lines

Figure 4.8: Incrementally fitting a line and mean square error (residual). The circles on the left hand side correspond to a 1σ-region around the edgels.

Im Dokument Error Propagation (Seite 77-84)