# Highly Curved Lane Detection Algorithms Based on Kalman Filter
## 2 Research Method
### Curve Lane Detection Based on Kalman Filter and Parabola Equation  
In this paper, the most important part is the curve line detection part. This method should detect a straight or a curve line in the far-field of view. Image data (white points in the far-field of view) include uncertainties and noise generated during capturing and processing steps. Therefore, as a robust estimator against these irregularities, a Kalman filter was adopted to form an observer [22]. First of all, we need to define the equation of the curve line, which is a non-linear equation. For the curve line, the best-fit equations are the parabola equation and the circle equation. In this part, we consider a curve lane detection algorithm which is based on the Kalman filter and Parabola equation. From parabola equation \(y\ =\ ax^{2}+bx+c\) we need to define three parameters using at least three measurement data. Equations (7) and (8) show system equation of the parabola. Figure 4 illustrates the basic parabolic model of road turning. \[\left\{ \begin{array}{l}y_{i-1}\ =\ ax_{i-1}^{2}+bx_{i-1}^{1}+cx_{i-1}^{0}\\ y_{i}\ =\ ax_{i}^{2}+bx_{i}^{1}+cx_{i}^{0}\\ y_{i+1}\ =\ ax_{i+1}^{2}+bx_{i+1}^{1}+cx_{i+1}^{0}\end{array} \right. \tag{7}\]  
\[\left[ \begin{array}{ccc}x_{i-1}^{2}&x_{i-1}^{1}&x_{i-1}^{0}\\ x_{i}^{2}&x_{i}^{1}&x_{i}^{0}\\ x_{i+1}^{2}&x_{i+1}^{1}&x_{i+1}^{0}\end{array} \right]\left[ \begin{array}{c}a \\ b\\ c\end{array} \right]=\left[ \begin{array}{c}y_{i-1}\\ y_{i}\\ y_{i+1}\end{array} \right] \tag{8}\]  
where \(x_{i-1},x_{i},x_{i+1}\) and \(y_{i-1},y_{i},y_{i+1}\) are the measurement data of the curve line detection process. In our case, the measurement data are the coordinates of the white points in the far section. From Equation (9) we can estimate \(a,b,c\) parameters easily. \[\left[ \begin{array}{c}a\\ b\\ c\end{array} \right]=\left( \begin{array}{cccc}x_{i-1}^{2}&x_{i-1}^{1}&x_{i-1}^{0} \\ x_{i}^{2}&x_{i}^{1}&x_{i}^{0}\\ x_{i+1}^{2}&x_{i+1}^{1}&x_{i+1}^{0}\end{array} \right]\right)\left[ \begin{array}[ ]{c}y_{i-1}\\ y_{i}\\ y_{i+1}\end{array} \right] \tag{9}\]  
Using this matrix form we can implement our Kalman filter design for curve lane detection. Two important matrices of the Kalman filter are the measurement transition matrix (H) and the state transition matrix (A). It can be expressed as Equation (10):  
\[[Y_{i}]\ =\ [H_{i}][X_{i}] \tag{10}\]  
In our case, the measurement transformation matrix \([H_{i}]\) contains three white points coordinate values of \(x\) axis rearranging the calculation as Equation (11). But, the transition matrix is the identity matrix, because of our Kalman filter design used for the image process. \[[Y_{i}]\ =\ \left[ \begin{array}{c}y_{i-1}\\ y_{i}\\ y_{i+1}\end{array} \right][H_{i}]\ =\ \left[ \begin{array}{cccc}x_{i-1}^{2}&x_{i-1}^{1}&x_{i-1}^{0} \\ x_{i}^{2}&x_{i}^{1}&x_{i}^{0}\\ x_{i+1}^{2}&x_{i+1}^{1}&x_{i+1}^{0}\end{array} \right]\left[ \begin{array}{c} X_{prior}\end{array} \right]\ =\ \left[ \begin{array}{c}a\\ b\\ c\end{array} \right] \tag{11}\]  
These two matrices are often referred to as the process and the measurement models, as they serve as the basis for a Kalman filter. The Kalman filter has two steps: the prediction step and the correction step. The prediction step can be expressed as follows, Equations (12) and (13):  
\[X_{post}\ =\ A_{i}X_{prior}+Bu_{k};\ \left[X_{post}\right]\ =\ \left[X_{prior}\right] \tag{12}\]  
\[P_{post}\ =\ A_{i}P_{prior}A_{i}^{T}+Q_{r};\ \ \ P_{post}\ =\ P_{prior}+Q_{r} \tag{13}\]  
where \(P_{post}\) is the covariance of the predicted state. The correction steps of the Kalman filter can be expressed through the following Equations (14), (15) and (17). \[K_{i+1}\ =\ (P_{post}H^{T})\left(HP_{post}H^{T}+R\right)^{-1}+Q_{r} \tag{14}\]  
Figure 4: Parabola model of the road turning. \[X_{post}\ =\ X_{prior}+K\Big{(}z_{i}-H_{i}X_{prior}\Big{)};\ \ z_{i}\ =\ \left[ \begin{array}{c}y_{meas(i-1)}\\ y_{meas(i)}\\ y_{meas(i+1)}\end{array}