A Closed-Form Error Model of Straight Lines for Improved Data Association and Sensor Fusing

Linear regression is a basic tool in mobile robotics, since it enables accurate estimation of straight lines from range-bearing scans or in digital images, which is a prerequisite for reliable data association and sensor fusing in the context of feature-based SLAM. This paper discusses, extends and compares existing algorithms for line fitting applicable also in the case of strong covariances between the coordinates at each single data point, which must not be neglected if range-bearing sensors are used. Besides, in particular, the determination of the covariance matrix is considered, which is required for stochastic modeling. The main contribution is a new error model of straight lines in closed form for calculating quickly and reliably the covariance matrix dependent on just a few comprehensible and easily-obtainable parameters. The model can be applied widely in any case when a line is fitted from a number of distinct points also without a priori knowledge of the specific measurement noise. By means of extensive simulations, the performance and robustness of the new model in comparison to existing approaches is shown.


Introduction
Contour points acquired by active sensors using sonar, radar or LiDAR [1], or extracted from image data [2,3], are a key source of information for mobile robots in order to detect obstacles or to localize themselves in known or unknown environments [4,5]. For this purpose, often, geometric features are extracted from raw data since in contrast to detailed contours, features are uniquely described just by a limited set of parameters, and their extraction works as additional filtering in order to improve reliability when dealing with sensor noise and masking [6]. However, the performance of feature-based localization or SLAM strongly depends on exact the determination of a feature vector y from measured raw data. Moreover, especially for data association, as well as for sensor fusing, not only the feature parameters are needed, but also a reliable estimation of their uncertainty is required. Generally, in the case of non-linear multi-sensor fusing, likelihood-based models can be applied (see [7]), which employ Bayesian filtering [8] or the calculation of entropies [9] to quantify uncertain information. Alternatively, especially for localization and map building, sensor fusing often is achieved with a Kalman filter (EKF). For this purpose, the covariance matrix R is required, which encapsulates the variances of the single elements in y and their dependencies.
This will be obvious if one looks at the standard algorithm for updating an estimated system statê x typically by means of EKF; compare [10][11][12]: new measurements y are plausible if their deviations from expected measurementsŷ = h(x) dependent on the in general non-linear measurement model h(x) are within a limited range. For exact calculation of this limit, usually the Mahalanobis metric is applied (see [11,13]), which considers the covariance matrix S of the innovation ν = y −ŷ with S = R + H ·P · H T dependent on R, the covariance matrixP of the system state and using H = ∇h(x). A new measurement y will be considered to relate to an already known feature vectorŷ if its distance these two parameters, the mean squared error MSE considering the perpendicular distances of N measurement points from the fitted line needs to be minimized. For this purpose, each perpendicular distance ρ i of point i is calculated either from polar or with x i = r i cos θ i and y i = r i sin θ i alternatively in Cartesian coordinates as: Then, MSE is defined as follows dependent on φ and d: In (2), optional scaling values s i are included in order to consider the individual reliability of each measurement point. By calculating the derivatives of (2) with respect to φ and d and setting both to zero, the optimum values of these parameters can be analytically derived assuming all s i to be constant, i.e., independent of φ and d. The solution has been published elsewhere (compare [32]), and in the Appendix of this paper, a straightforward derivation is sketched, yielding for φ and d: The function atan2() means the four quadrant arc tangent, which calculates φ always in the correct range. If d becomes negative, its modulus must be taken, and the corresponding φ has to be altered by plus or minus π. In these equations,x andȳ denote the mean values of all N measurements x i and y i , while σ 2 x , σ 2 y and σ xy denote the variances and the covariance: In (5)-(9), normalized weighting factors w i are used with 1 N ∑ N i=1 w i = 1 and 0 ≤ w i ≤ 1, calculated dependent on the chosen scaling values s i : As pointed out in [35], for accurate line matching, the scaling values s i must not be assumed to be constant since in general, they depend on φ. This can be understood from Figure 2, which shows for one measurement point i the error ellipse spanned by the standard deviations σ x,i and σ y,i , while the rotation of the ellipse is caused by the covariance σ xy,i .  Apparently, as a measure of confidence, only the deviation σ ρ,i perpendicular to the line is relevant, while the variance of any data point parallel to the fitted line does not influence its reliability. Thus, the angle φ given in (3) will only be exact, if the error ellipse equals a circle, which means that all measurements exhibit the same standard deviations in the xas in the y-direction, and no covariance exists. Generally, in order to determine optimum line parameters with arbitrary variances and covariance of each measurement i, in Equation (2) the inverse of σ ρ,i dependent on φ has to be used as scaling factor s i , yielding: In this formula, which can only be solved numerically, the variance σ 2 ρ,i needs to be calculated dependent on the covariance matrix of each measurement point i. In the case of line fitting from range-bearing scans, the covariance matrix R rθ,i can be modeled as a diagonal matrix since both parameters r i and θ i are measured independently, and thus, their covariance σ rθ,i equals zero: Typically, this matrix may also be considered as constant, thus independent of index i, assuming that all measured radii and angles are affected by the same noise, i.e., R rθ,i ≈ R rθ .
With known variances σ 2 r,i and σ 2 θ,i and for a certain φ, now σ 2 ρ,i is determined by evaluating the relation between ρ i and the distances d i of each data point with 1 ≤ i ≤ N. According to (1) and with the distance d written as the mean of all d i , it follows: Since noise-induced variations of all distances d i are uncorrelated with each other, now the variance σ 2 ρ,i is calculated by means of summing over all variances σ 2 d,i : In order to derive σ 2 d,i , changes of d i with respect to small deviations of r i and θ i from their expected valuesr i andθ i are considered with d i =d i + ∆d i , r i =r i + ∆r i and with θ i =θ i + ∆θ i : The terms on the right side of (15) can be determined independently of each other, since ∆r i and ∆θ i are assumed to be uncorrelated. With d i = r i · cos(θ i − φ), it follows: and: In the last line, the addition theorem was applied for cos(θ i − φ + ∆θ i ), and for small variations, the approximations cos(∆θ i ) ≈ 1 − ∆θ 2 i 2 and sin(∆θ i ) ≈ ∆θ i are valid. The random variables ∆r i and ∆θ i are assumed to be normally distributed with variances σ 2 r,i and σ 2 θ,i . Thus, the random variable ∆θ 2 i exhibits a χ 2 -distribution with variance 2(σ 2 θ,i ) 2 (see [44]), and the variance of d i is calculated from (15)-(17) as the weighted sum withr i andθ i approximately replaced by r i and θ i , respectively: When applying this algorithm, a one-dimensional minimum search of MSE according to (11) needs to be executed, yielding the optimum φ of the straight line. For this purpose, σ 2 ρ,i is inserted from (14) considering (18) and ρ i is determined according to (1) by calculating d from (4) and (8)- (10) Obviously, numerical line fitting can also be accomplished if measurements are available in Cartesian coordinates x i and y i . In this case, the covariance matrix R xy,i of each measurement point must be known, defined as: Furthermore, the partial derivatives of d i according to (1) with respect to x i and y i need to be calculated: Then, σ 2 d,i follows dependent on R xy,i and J d,i : If raw data stem from a range-bearing scan, R xy,i can be calculated from R rθ,i by exploiting the known dependencies between the polar and Cartesian plane. For this purpose, the Jacobian matrix J xy,i is determined: Then, the covariance matrix R xy,i will depend on R rθ,i , if small deviations from the mean value of the random variables r i and θ i and a linear model are assumed: According to (23), generally a strong covariance σ xy,i in R xy,i must be considered, if measurements are taken by range-bearing sensors.
By means of applying (21)-(23) instead of (18) for searching the minimum of MSE dependent on φ, the second order effect regarding ∆θ i is neglected. This yields almost the same formula as given in [35], though the derivation differs, and in [35], additionally, the variance of d is ignored assuming (14) is only asymptotically correct for large N. Finally, it should be noted that the numerical determination of φ according to (11) means clearly more complexity compared to the straightforward solution according to Equation (3). Later, in Section 5, it will be analyzed under which conditions this additional computational effort actually is required.

Analytic Error Models of Straight Lines
In the literature, several methods are described to estimate errors of φ and d and their mutual dependency. Thus, the covariance matrix R dφ must be known, defined as: For this purpose, a general method in nonlinear parameter estimation is the calculation of the inverse Hessian matrix at the minimum of MSE. Details can be found in [30,35], while in [45], it is shown that this procedure may exhibit numerical instability. In Section 5, results using this method are compared with other approaches.
Alternatively, in [32,46], an analytic error model is proposed based on fault analysis of the line parameters. In this approach, the effect of variations of each single measurement point defined by R xy,i with respect to the covariance matrix of the line parameters R dφ is considered, based on (3) and (4). Thereto, the Jacobian matrix J dφ,i with respect to x i and y i is determined, defined as: With this matrix, the contribution of a single data point i to the covariance matrix between d and φ can be written as: For determining the partial derivatives of d in (25), Equation (4) is differentiated after expanding it by (8) and (9), yielding: Differentiating φ according to (3) with respect to x i gives the following expression with u = −2σ xy The partial derivation of u in (29) is calculated after expanding it with (7) and (8) as: while partial derivation of v with (5), (6) and (8) yields: Finally, after substituting all terms with u and v in (29), it follows: Correspondingly, for the partial derivative of φ with respect to y i , the following result is obtained: Now, after inserting (27), (28), (32) and (33) into (25), the covariance matrix of d and φ (24) is calculated by summing over all N data points since the noise contributions of the single measurements can be assumed to be stochastically independent of each other: Equation (34) enables an exact calculation of the variances σ 2 d , σ 2 φ and of the covariance σ dφ as long as the deviations of the measurements stay within the range of a linear approach, and as long as Equations (3) and (4) are valid. In contrast to the method proposed in [35], no second derivatives and no inversion of the Hessian matrix are needed, and thus, more stable results can be expected.
However, both algorithms need some computational effort especially for a large number of measurement points. Moreover, they do not allow one to understand the effect of changing parameters on R dφ , and these models can only be applied, if for each data point, the covariance matrix R xy,i is available. Unfortunately, for lines extracted from images, this information is unknown, and also, in the case of using range-bearing sensors, only a worst case estimate of σ r is given in the data sheet, while σ θ is ignored.

Closed-Form Error Model of a Straight Line
In this section, a simplified error model in closed form is deduced, which enables a fast, clear and yet, for most applications, sufficiently accurate calculation of the covariance matrix R dφ in any case when line parameters d and φ have been determined from a number of discrete data points.
Thereto, first, the expected values of the line parameters d and φ, denoted asd andφ, are assumed to be known according to the methods proposed in Section 2 withd ≈ d andφ ≈ φ. Besides, for modeling the small deviation of d and φ, the random variables ∆d and ∆φ are introduced. Thus, with d =d + ∆d and φ =φ + ∆φ, it follows for the variances and the covariance: Next, ∆d and ∆φ shall be determined dependent on a random variation of any of the N measured data points. For this purpose, Figure 3 is considered, which shows the expected line parameters and the random variables ∆d and ∆φ. Figure 3. Dependency between ∆d, ∆φ and geometric parameters.
In order to derive expressions for ∆d and ∆φ depending on the random variables ρ i , Figure 4 shows an enlargement of the rectangular box depicted in Figure 3 along the direction of the linex. First, the effect of variations of any ρ i on ∆φ is considered. Since ∆φ is very small, this angle may be replaced by its tangent, which defines the slope ∆m of the line with respect to the directionx. Here, only ρ i is considered as random variable, but notx i . Thus, the standard formula for the slope of a regression line can be applied (see, e.g., [26] Chapter 2), which will minimize the mean squared distance in the direction of ρ, if allx i are assumed to be exactly known: Now, in order to calculate the variance of ∆φ, a linear relation between ∆φ and each ρ i is required, which is provided by the first derivation of (36) with respect to ρ i : Then, the variance of ∆φ dependent on the variance of ρ i can be specified. From (37), it follows: If σ 2 ρ,i is assumed to be approximately independent of i, it may be replaced by σ 2 ρ and can be estimated from (2) with ρ i taken from (1) and setting all s i to 1/N: It should be noted that for a bias-free estimation of σ 2 ρ with (39), the exact line parameters φ and d must be used in (1), which obviously are not available. If instead, estimated line parameters according to Section 2 are taken, e.g., by applying (3) and (4), calculated from the same data as used in (39), an underestimation of σ 2 ρ especially for small N can be expected, since φ and d are determined by minimizing the variance of ρ of these N data points. This is referred to later.
Next, from (38), the variance of ∆φ results as the sum over all N data points, since all ρ i are independent of each other: Equations (40) with (35) and (39) enables an exact calculation of σ 2 φ dependent on the N data points of the line.
However, from (40), a straightforward expression can be derived, which is sufficiently accurate in most cases and enables a clear understanding of the influencing parameters on σ 2 φ ; compare Section 5. For this purpose, according to Figure 3, the length L of a line segment is determined from the perpendicular distance d and from the angles θ 1 and θ N of the first and N-th data point, respectively: Furthermore, a constant spacing ∆x between adjacent data points is assumed: Applying this approximation, the sum over all squaredx i can be rewritten, yielding for even N as depicted in Figure 4: The last sum can be transformed into closed form as: With N odd, the sum must be taken twice from 1-N−1 2 , since in this case, the central measurement point has no effect on σ 2 ∆φ,i , yielding: Again, the last sum can be written in closed form, which gives the same result as in (44): Finally, by substituting (43) with (44) or (45) with (46) into (40) and regarding (35), as well as (42), a simple analytic formula for calculating the variance of φ is obtained, just depending on L, N and the variance of ρ: The last simplification in (47) overestimates σ 2 φ a little bit for small N. Interestingly, this error compensates quite well for a certain underestimation of σ 2 ρ according to (39), assuming that the line parameters φ and d are determined from the same data as σ 2 ρ ; see Section 5. Next, in order to deduce the variance σ 2 d , again, Figure 3 is considered. Apparently, the first part of the random variable ∆d is strongly correlated with ∆φ since any mismatch in φ is transformed into a deviation ∆d by means of the geometric offset x o f f with: Actually, with a positive value for x o f f , as depicted in Figure 3 the correlation between ∆d and ∆φ becomes negative, since positive values of ∆φ correspond to negative values of ∆d. According to Figure 3, x o f f is determined from φ and d, as well as from θ 1 and θ N : Alternatively, x o f f can be taken as the mean value from all N data points of the line segment: Nevertheless, it should be noted that ∆d is not completely correlated with ∆φ, since also in the case x o f f = 0, the error ∆d will not be zero.
Indeed, as a second effect, each single ρ i has a direct linear impact on the variable ∆d. For this purpose, in Figure 4, the random variable ∆d ρ is depicted, which describes a parallel shift of the regression line due to variation in ρ i , calculated as the mean value over all ρ i : Combining both effects, variations in d can be described as the sum of two uncorrelated terms, ∆d φ and ∆d ρ : This missing correlation between ∆φ and the sum over all ρ i is also intuitively accessible: if the latter takes a positive number, it will not be possible to deduce the sign or the modulus of ∆φ. From (52) and with E(∆d φ ·∆d ρ ) = 0, E(∆d φ ) = 0 and E(∆d ρ ) = 0, the variance σ 2 d can be calculated as: In the last step from (53) to (54), again, the independence of the single measurements from each other is used; thus, the variance of the sum of the N data points approximates N-times the variance σ 2 ρ . Finally, the covariance between φ and d needs to be determined. Based on the definition, it follows with σ dφ = σ ∆d∆φ : By means of (47), (54) and (55), now, the complete error model in closed form is known, represented by the covariance matrix R dφ given as: Applying this error model is easy since no knowledge of the variances and covariance for each single measurement is needed, which in practice is difficult to acquire. Instead, just the number N of preferably equally-spaced points used for line fitting, the variance σ 2 ρ according to (39), the length L of the line segment calculated with (41) and its offset x o f f according to (49) or (50) must be inserted.

Simulation Results
The scope of this section is to compare the presented algorithms for linear regression and error modeling based on statistical evaluation of the results. Segmentation of raw data is not considered; if necessary, this must be performed beforehand by means of well-known methods like Hough transformation or RANSAC; compare Section 1. Thus, for studying the performance reliably and repeatably, a large number of computer simulations was performed, applying a systematic variation of parameters within a wide range, which would not be feasible if real measurements are used.
For this purpose, straight lines with a certain perpendicular distance d from the origin and within a varying range of normal angles φ have been specified. Each of these lines is numerically described by a number of N points either given in Cartesian (x i , y i ) or in polar (r i θ i ) coordinates. In order to simulate the outcome of a real range-bearing sensor as much as possible, the angular coordinate was varied between θ 1 and θ N . To each measurement, a certain amount of normally-distributed noise with σ x , σ y and σ xy or alternatively with σ r and σ θ was added. Further, for each φ, a number of N s = 1000 sets of samples was generated, in order to allow statistical evaluation of the results. The first simulation was performed with N = 40 equally-spaced points affected each by uncorrelated noise in the xand y-direction with standard deviations σ x = σ y = 5 cm. This is a typical situation when a line is calculated from binary pixels, and in Figure 5a, a bundle of the simulated line segments is shown. The deviations ∆ φ and ∆ d taken as the mean value over all N s samples of the estimated φ and d from their true values, respectively, are depicted in Figure 5b,c, comparing four algorithms as presented in Section 2: The triangles mark the outcome of Equations (3) and (4) with all weights set to one, whereas the squares are calculated according to the same analytic formulas, but using individual weighting factors applying (10) with s i = 1/σ ρ,i . The perpendicular deviations σ ρ,i are determined according to (14) and (21) with φ taken from (3) without weights. Obviously, in this example, all triangles coincide with the squares since each measurement i is affected by the same noise and thus for any φ, all weighting factors are always identical. The blue lines in Figure 5b,c show the results when applying the iterative method according to (11) with the minimum of MSE found numerically. For this purpose, (14) considering (21) and ρ i is taken from (1) and d is calculated from (4), (8)-(10) with s i = 1/σ ρ,i . The black lines (KA) depict the deviations of d and φ obtained according to Krystek and Anton in [35]. Both numerical algorithm yield the same results, which is not surprising, since the variances σ 2 ρ,i used as weighting factors are all identical. Further, here, the analytical algorithms provide exactly the same performance as the numerical ones, since for σ x = σ y . the weighting factors show no dependency on φ, and for that case, the analytical formulas are optimal. The lower subfigures depict the parameters of the covariance matrix R dφ , again as a function of φ comparing different methods. Here, the circles represent numerical results obtained from the definitions of variance and covariance by summing over all N s passes with 1 ≤ k ≤ N s , yielding d k and φ k , respectively: Since these numerical results serve just as a reference for judging the accuracy of the error models, in the formulas above, the true values for d and φ have been used. The required line parameters d k and φ k in (57)-(59) can be estimated with any of the four described methods, since minor differences in d k and φ k have almost no effect on the resulting variances and the covariance. The blue lines in Figure 5d-f show the results of the analytic error model as described in Section 3, and the black lines represent the outcomes of the algorithm from Krystek and Anton [35], while the red lines corresponds to the model in closed-form according to (56) in Section 4 with L and x o f f taken from (41) and (49), respectively. Interestingly, although the theoretical derivations differ substantially, the results match very well, which especially proves the correctness of the simplified model in closed-form. Since this model explicitly considers the effect of the line length L and of the geometric offset x o f f , the behavior of the curves can be clearly understood: The minimum of L will occur if φ equals the mean value of θ min and θ max , i.e., at φ = 55 • , and exactly at this angle, the maximum standard deviation σ φ occurs. Further, since L linearly depends on φ, a quadratic dependence of σ φ on φ according to (47) can be observed. With respect to Figure 5e, the minimum of σ d also appears at φ = 55 • corresponding to x o f f = 0. At this angle, according to (54), the standard deviation of d is given as 79, while the covariance σ ρd calculated according to (55) and with it the correlation coefficient shown in Figure 5f vanish.
When comparing the results, one should be aware that in the simulations of the analytic error models, the exact variances σ 2 x i , σ 2 y i and σ xy i are used; thus, in practice, the achievable accuracies will be worse. On the other hand, when applying the new error model in closed-form, the variance σ 2 ρ is calculated as the mean value of all ρ 2 i from the actual set of N data points according to (39), and hence, is always available.
Nevertheless, if in this equation, the estimated line parameters φ and d are used, which are calculated, e.g., according to (3) and (4) using the same measurements as in (39), no unbiased σ 2 ρ can be expected. This is reasoned from the fact that for each set of N data points, the mean quadratic distance over all ρ 2 i is minimized in order to estimate φ and d. Thus, the numeric value of σ 2 ρ will always be smaller than its correct value calculated with the exact line parameters. This effect can be clearly observed from Figure 6, which shows for the same simulation parameters as depicted in Figure 5a the dependency of σ 2 ρ on the number of points on the line N, averaged over N s sets of samples: only in the case of using the exact line parameters in (39), which obviously are only available in a simulation, actually the correct σ 2 ρ = 25 cm 2 is obtained as shown by the triangles. If however, in each run, σ 2 ρ is calculated with the estimated φ and d as indicated by the squares, a clear deviation especially at low N occurs. Only asymptotically for large N when φ converges to its exact value, the correct σ 2 ρ is reached. Fortunately, this error can be compensated quite well by means of multiplying σ 2 ρ with a correction factor c = N+1 N−1 as shown by the dashed line in Figure 6. Due to the strongly non-linear relation between φ and any ρ i , this correction works much better than simply exchanging in (39) the divisor N by N − 1 as often used in statistics. Since c is the inverse of the term neglected in the approximation of σ 2 φ in (47), the closed-form of the covariance matrix R dφ according to (56) yields almost unbiased results also for small N if σ 2 ρ is calculated according to (39) with estimated line parameters φ and d. Although not shown here, the proposed bias compensation works well for a large range of measurement parameters. For a reliable determination of σ 2 ρ from N data points of a line segment, N should be at least in the order of 10. Figure 7 shows the results when simulating a range-bearing scan with a constant angular offset ∆θ = (θ max − θ min )/(N −1) between adjacent measurements. Each measurement is distorted by adding normally-distributed noise with standard deviations σ r = 5 cm and σ θ = 0.1 • . This is a more challenging situation, since now that the measurements are not equispaced, each data point exhibits individual variances σ x,i , σ y,i dependent on φ, and moreover, a covariance σ xy,i exists. As can be seen, the errors of the estimated φ and d as depicted in Figure 7b,c exhibit the same order of magnitude as before; yet, both analytic results differ slightly from each other and are less accurate compared to the numerical solutions. Both numerical methods yield quasi-identical results, since for the chosen small noise amplitudes, the differences between both algorithms have no impact on the resulting accuracy. The next Figure 8 shows the results with the models applied to short lines measured in the angular range of 30 • ≤ θ ≤ 40 • with N = 20, while all other parameters are identical to those depicted in Figure 7a. As can be seen from Figure 8b,c, now, the analytical algorithms based on (3) and (4) are no longer adequate since these, independent of applying weights or not, yield much higher errors than the numerical approaches. All error models however still provide accurate results. Actually, the closed-form model even yields better accuracy than before, since the distances of the data points on the line between adjacent measurement and also σ ρ,i are more uniform compared to the simulations with long lines. In order to check the limits of the models, Figure 9 depicts the results when applying large angular noise with σ θ = 2 • . In this extreme case, also the numerical algorithms show systematic errors dependent on φ since the noise of ρ i can no longer be assumed to be normally distributed. However, according to Figure 8b,c the iterative method as presented in Section 2 shows clear benefits in comparison to the KA algorithm proposed in [35], caused by the more accurate modeling of σ ρ i .
With respect to the outcome of the noise models in Figure 9d-f, now, only the analytic algorithm as presented in Section 3 still yields reliable results, while the KA-method based on matrix inversion reveals numerical instability. Due to the clear uneven distribution of measurements along the line, also the simplified error model in this case shows clear deviations, although at least the order of magnitude is yet correct.
Finally, Figure 10 shows typical results, if the sensor noise is not exactly known. In this example, the radial standard deviation was assumed to be 10 cm, whereas the exact value, applied when generating the measurements, was only 5 cm. The simulation parameters correspond to those in Figure 7, only the number of data points has been reduced to N = 10. According to Figure 10b,c, now, for calculating φ and d, the numerical methods yield no benefit over the analytical formulas with or without weights. Due to the only approximately known variance, the analytic error model, as well as the KA-method in Figure 10d-f reveal clear deviations from the reference results. Only the model in closed-form is still accurate, since it does not require any a priori information regarding sensor noise. In addition, these results prove the bias-free estimation of σ 2 ρ with (39) also if N is low, as depicted in Figure 6.

Conclusions
In this study, the performance of linear regression is evaluated, assuming both coordinates as random variables. It is shown that, especially with range-bearing sensors, frequently used in mobile robotics, a distinct covariance of the noise in the xand y-direction at each measurement point exists. In this case, analytical formulas assuming identical and uncorrelated noise will only provide accurate line parameters φ and d if the detected line segments are sufficiently long and the noise level stays below a certain limit. If these prerequisites are not fulfilled and if the sensor noise is known, numerical algorithms should be applied, which consider the reliability of each measurement point as a function of φ. For this, the performance of prior work can be improved by means of modeling the independence of the single data points exactly and by paying attention also to second order effects of the angular noise.
The main focus of this paper is on the derivation of the covariance matrix R dφ of straight lines. This information has a crucial impact on the performance of SLAM with line features, since for both, data association and sensor fusing, R dφ must be estimated precisely. For this purpose, the first analytical error models are reviewed, which however need exact knowledge of the measurement noise, although in many applications, this is not available. In addition, these approaches require high computational effort and do not allow one to comprehend the effect of measurement parameters on the resulting accuracy of an estimated straight line. Thus, a new error model in closed form is proposed, depending only on two geometric parameters, as well as on the number of points of a line segment. Besides, a single variance must be known, which is determined easily and reliably from the same measurements as used for line fitting. By means of this model, the covariance matrix can be estimated quickly and exactly. Moreover, it allows one to adapt measurement conditions in order to achieve the maximum accuracy of detected line features.

Acknowledgments:
The author greatly appreciates the editor's encouragement and the valuable comments of the reviewers. This work has been partially supported by the German Federal Ministry of Education and Research (Grant No. BMBF 17N2008) and funded by the department of computer science and media at Beuth university.

Conflicts of Interest:
The author declares no conflict of interest.

Appendix A. Analytic Derivation of Straight Line Parameters With Errors in Both Coordinates
For the derivation of the perpendicular distance d, the partial derivative of Equation (2) with respect to d is taken and set to zero, which directly gives Equation (4) using (8)- (10). In order to calculate φ, first the partial derivation of (2) with respect to φ must be calculated and set to zero, yielding: Now, the distance d can be replaced by (4), and after inserting the definitions ofx,ȳ, σ 2 x , σ 2 y and σ xy according to (5)-(9) considering (10), it follows from (A1) after reordering: Applying the theorem of Pythagoras and the addition theorems of angles, the terms with the sine and cosine can be rewritten: cos 2 φ − sin 2 φ = 2 cos 2 φ − 1 = cos 2φ (A3) sin φ cos φ = 1 2 sin 2φ (A4) Inserting these formulas into (A2) finally yields for φ: Equation (A5) calculates φ always in the range −π/4 < φ < π/4, although according to Figure 1, this is only correct if σ 2 y > σ 2 x , while in the case σ 2 y < σ 2 x , an angle π/2 must be added to φ. Thus, as general solution (3) should be taken also avoiding a special consideration if σ 2 y equals σ 2 x .