A Novel Algorithm Based on the Pixel-Entropy for Automatic Detection of Number of Lanes, Lane Centers, and Lane Division Lines Formation

Lane detection for traffic surveillance in intelligent transportation systems is a challenge for vision-based systems. In this paper, a novel pixel-entropy based algorithm for the automatic detection of the number of lanes and their centers, as well as the formation of their division lines is proposed. Using as input a video from a static camera, each pixel behavior in the gray color space is modeled by a time series; then, for a time period τ, its histogram followed by its entropy are calculated. Three different types of theoretical pixel-entropy behaviors can be distinguished: (1) the pixel-entropy at the lane center shows a high value; (2) the pixel-entropy at the lane division line shows a low value; and (3) a pixel not belonging to the road has an entropy value close to zero. From the road video, several small rectangle areas are captured, each with only a few full rows of pixels. For each pixel of these areas, the entropy is calculated, then for each area or row an entropy curve is produced, which, when smoothed, has as many local maxima as lanes and one more local minima than lane division lines. For the purpose of testing, several real traffic scenarios under different weather conditions with other moving objects were used. However, these background objects, which are out of road, were filtered out. Our algorithm, compared to others based on trajectories of vehicles, shows the following advantages: (1) the lowest computational time for lane detection (only 32 s with a traffic flow of one vehicle/s per-lane); and (2) better results under high traffic flow with congestion and vehicle occlusion. Instead of detecting road markings, it forms lane-dividing lines. Here, the entropies of Shannon and Tsallis were used, but the entropy of Tsallis for a selected q of a finite set achieved the best results.


Introduction
The global trend toward urbanization has experienced a worrying growth over the last 30 years, contributing to make cities socially, economically and environmentally unsustainable. One major serious aspect of urbanization is transportation, which includes traffic congestion, longer commutes, inadequate public transport, high infrastructure maintenance costs, environmental impacts and poor safety. Consequently, there has been an increasing requirement of developing intelligent systems with the purpose of improving the quality, rentability and use of the transportation in urban areas [1]. major disadvantages is that lane markings are not always clearly visible due to the print wear off and to the image clarity by changes in environmental conditions. Trajectory clustering-based methods. Melo et al. [13] proposed a method through a vehicle trajectory analysis with occlusion handling. First, vehicles are detected each frame by an adaptive smoothness algorithm for building a background model; then, Kalman filter is used to track vehicles trajectories which are represented by a low degree polynomial; and, finally, the lane centers are extracted by k-means clusters of trajectories. Ren et al. [14] proposed an enhanced trajectory-based framework for lane centers detection with a fast extraction of trajectories via vehicle feature points which are tracked by the pyramidal Kanade-Lucas-Tomasi algorithm. Then, trajectories are clustered by a modified k-means algorithm with Hausdorff distance for a fast trajectory extraction achieving a high accurate system. Trajectory clustering-based methods perform better than lane marking-based methods overcoming certain weaknesses. The major disadvantage of trajectory-based methods is that they require a set with a high number of well-formed trajectories on each lane which cannot be reached in short periods of time.
Motivated by the disadvantages and limitations of the traditional lane marking-based and trajectory-based methods mentioned in this section, we propose an algorithm for lane center detection and lane division lines formation.
By analyzing previous work, we conclude that, although lane markings-based methods and trajectory-based methods perform well in the lane detection, several issues related to their implementation are still unsolved:  (4) the performance under traffic congestion is higher than trajectory-based methods; (5) automatic selection of lanes; (6) robustness to partial occlusion and shadows; and (7) no prior camera parameters initialization is needed.

Probability Space
A probability space [15] is a mathematical triplet (Ω, F , P) which models a random process, where Ω is the sample space, F the event space, and P a probability function which associates to each event ζ i ∈ F a probability p i .

Shannon Entropy
Let X be a random variable (r.v.), which can take values of a finite set, i.e., X = {x 1 , x 2 , ..., x N } of cardinality N, with a probability distribution P, p i := P(X = x i ); then, the associated Shannon entropy S(X) of a r.v. X is defined as follows [16]: S(X) has a maximum in the case of equiprobability, i.e., p i = 1 N , ∀i:

Tsallis Entropy
Tsallis [17] proposed a generalization of the celebrated Boltzmann-Gibbs entropy S BG measure able to describe extensive and non-extensive physical systems. The Tsallis entropy for a given probability distribution P = (p 1 , p 2 , ..., p N ) or of a random variable X, with a probability distribution p i = P(X == x i ), i := 1, 2, ..., N, is defined as follows: where N ∈ N + is the total number of possible microscopic configurations of the whole system, and q ∈ R the entropic index that characterizes the system degree of non-extensivity. Tsallis entropy has four important mathematical properties derived from the inclusion of the entropic index q (see [17]). Figure 1 shows an illustration of the Tsallis entropy for two probabilities p 1 and p 2 , where p 2 = 1 − p 1 with several entropic index values.

Time Series
A time series [18] is a sequence of observations on variables indexed by a set of time t. Each element of a time series is represented by the pair (a i , t i ), where a i ∈ R n is the measured value and t i is the associated time index. Formally, a time series A is described as follows:

Histogram
A histogram H(X) is an estimator of the Probability Density Function (pdf) of a continuous random variable X, which can be expressed as Equation (5).
where h i = N i N is the relative frequency of X, m the number of classes known as bin, N i the number of observations in the class i, and N the total number of observations.

Peaks and Valleys
Let f (x) be a function which transforms x from a domain U ⊆ R to the domain R. A peak is defined as a local maxima of f (x), and similarly, a valley is defined as a local minima of f (x) [19]. Equations (6) and (7) define formally a peak and valley, respectively.
where I = (x a , x b ) is an interval such that I ∩ U = ∅, and x 0 ∈ I the peak or valley location. The peak width and prominence are two relevant features of a peak (see Figure 2). The peak width is defined as the distance between the points to the left and right of the peak where f (x) intercepts a reference height. While the prominence of a peak is the minimum vertical distance that f (x) descends before climbing back to a higher level or reaches a valley.

Algorithms
In this section, a short description of the algorithms K-means and DTW are presented.

K-Means
Let Y be a set of observations {y 1 , y 2 , ..., y N }, y i ∈ R n , the k-means algorithm [20] partitions the set Y into k subsets Υ = {Υ 1 , Υ 2 , .., Υ k }, k < N, such that the squares sum within each subset will be minimized in accordance with Equation (8)

Dynamic Time Warping
Sakoe and Chiba [5] introduced the DTW algorithm to align temporal sequences, which has been widely used mainly on speech recognition [5] and time series classification [21]. Consider two time series A = (a 1 , a 2 , ..., a M ) and B = (b 1 , b 2 , ..., b N ) of length M and N, respectively, where a i , b i ∈ R n , and let c be a local cost function defined as a distance d, such that a cost matrix C of size M × N is formed, where each element C i,j is defined as Equation (9).
A path P can be seen as an ordered set of points in R n . A warping path γ = {γ 1 , γ 2 , ..., γ K } is a sequence of tuples γ k = (i(k), j(k)) with an associated cost c(k) = c(i(k), j(k)), where i and j are the corresponding indexes of the a i and b j with its distance C i,j , and k ∈ [1 : K], K ≥ max(M, N), if and only if the following conditions are satisfied: 1. Boundary: γ 1 = (i(1), j(1)) and γ K = (i(M), j(N)). 2. Monotonicity: The set of indexes i(k) and j(k) of A and B are monotonically nondecreasing, i.e., i(1) ≤ i(2) ≤ ... ≤ i(K) and j(1) ≤ j(2) ≤ ... ≤ j(K). 3. Continuity: Consecutive nodes of γ must be reached by horizontal, vertical or diagonal steps of length 1: Then, the total cost for a warping path is given by: For the series A and B, we have several warping paths γ, where each of them has a total cost c γ , and the minimalĉ γ is called distance DTW(A, B).
Let Γ be the set of all possible warping paths between A and B. An optimal warping pathγ is defined as the path γ ∈ Γ with the minimum cost or distance DTW(A, B) (Equation (12)). The optimal warping path can be seen as a function of alignment whose domain is the set {1, 2, ..., K} and the codomain the set of pairs (i(k), j(k)). Then, it is said that the time series A and B are aligned (see Figure 3). Figure 3 shows two time series not aligned in time, Figure 3 presents its associated cost matrix and the optimal warping path found by DTW algorithm, and Figure 3 the alignment between series. It is important to note that, for any given element a i of A, there is at least one corresponding element b j in B which can be found in the optimal warping path, and vice versa.
(a) Two time series with different lengths (b) Cost matrix and the optimal warping path

Automatic Lane Detection
Lane detection algorithms are able to extract road features such as lane centers, lane division lines as well as lane boundaries. From vehicle trajectories, lane centers can be estimated, but the estimation of each lane is biased by driving behaviors caused by factors such as topologies of road networks, lane position and shoulder width, lane deviation, the field-of-view angle, etc. [22]. Here, we define two types of lanes: static and dynamic lanes. Static lanes are those lanes for which their position is time-invariant or geometric lanes, while dynamic lanes are those lanes which their position is time-variant and depends on external factors as previously mentioned.

Lane Model
A trajectory T of an object x can be seen as a time-ordered set or the states or positions of the object, and it is represented as T(x) = {x 1 , x 2 , ..., x m }, where x i ∈ R n contains a position sampled at time t i , and m is the length of T. Its associated path γ = {x 1 , x 2 , ..., x m } is only an ordered set.
A road can be modeled by L lanes and a set of 2L + 1 paths, which represents the positions of two main features of road (see Figure 4): (i) L Lane Center (L c (n)) is intended as a static path, whose elements are the midpoints of the lane; ND (ii) L + 1 Lane Division line (L d (n)) is intended as a series of markings on the road, equivalent to a path; where n is the lane number. Then, any lane center or lane division line L(n) can be represented by a polynomial; second or third degree polynomials describe very well several lane curvatures. For our case, we use only second-degree polynomial (see Equation (13)).
where n is the lane number, and a k the coefficients of the polynomial. For our models, discrete values of (x, y) points will be pixel positions denoted as φ (n) (i,j) . Given the curves representing the lanes as shown in Figure 4 and two different normal lines, at intersection points, the following properties hold: the Euclidean distance de(x i , y j ) = de(x u , y v ) for regular lanes at k-th lane and de(x i , y j ) = de(y j , z k ) when the two lanes have the same width.
Our goal is, given a certain number of estimated data points, to find the polynomial representinĝ L c (n) andL d (n) that best fit the lanes in the sense of mean squared error.

The Proposed Algorithm
In this section, we introduce the proposed algorithm for automatic detection of the number of lanes, lane centers and lane division lines formation based on the pixel-entropy and DTW. Our approach must perform five main tasks: parameter initialization, pixel histogram construction and pixel-entropy calculation, peak features extraction and classification, peak matching, and lane center and lane division line model by a second-degree polynomial fitting.
The lane detection algorithm based on the pixel-entropy is composed of the following blocks according to the diagram illustrated in Figure  Given a video V N of duration τ (N-frames) (see Figure 5), we need to calculate the pixel-entropy S i,j (X). Assuming that the traffic load is one vehicle/s per lane, we found that after 30 s the relative frequency corresponding to the pixel-entropy converge to a value, and the time needed for this convergence is denoted here as the transient time t r . Besides, for each frame, the histogram of several rows of pixels will be computed and accumulated for each pixel belonging to the j-th row. After t r has been elapsed, the entropy of each pixel is calculated, forming a pixel-entropy vector or curve for each j-th row of pixels, which will contain local maxima and minima that determine the lanes. Then, our algorithm estimates the lane centers and lane division lanes. For updating, this process will be repeated after a certain amount of time t u .

Pixel Time Series
Let V N = {I 1 , I 2 , ..., I N } be a video or a sequence of N frames of W × H (Width × Height) pixels, where the intensity values of each pixel in the grayscale can be represented by a discrete random variable X, then each pixel can be modeled by a time series x t (i, j), where t is the discrete time index and (i, j) the pixel position.

Background Image Estimation
A simple background image estimation is performed to separate moving objects in foreground from the background, which can be modeled by which satisfies some background criterion [23], e.g., the statistical mode of each x t (i, j) at which the Probability Mass Function (pmf) takes its maximum.

Pixel Histogram Construction
For each pixel, its histogram H i,j (X) = H(x t (i, j)) is computed and updated frame by frame. Any object moving across the background will change x t (i, j) for all its associated pixels and almost always the histogram as well. Then, its associated pixel pmf f X (x) is estimated and updated (to have a fair comparison of each pixel pmf, the number of bins or classes of each histogram is fixed and equal for all). The pmf f X (x) is the key input to the entropy estimators (see Section 4.2.4). Besides, histograms are the basis for the background image formation (see Section 4.2.2).

Pixel-Entropy Estimation
Based on f X (x), the pixel-entropy S i,j (X) is calculated as either Shannon or Tsallis by Equations (1) or (3), respectively. Several rows of pixels are selected; for each j-th row, a pixel-entropy vector S j (X) is formed (see Equation (14)), where each element of this vector is the pixel-entropy S i,j (X) at location (i, j) and j the selected row.
S j (X) = (S 1,j (X), S 2,j (X), ..., S i,j (X), ..., S W,j (X)) (14) where i ∈ [1, W] and j takes M from the H (height of the image) possible values. Based on the assumption that the pixel-entropy changes over time or not, three types of theoretical pixel-entropy behaviors can be distinguished:  During the acquisition process of an image, noises are added due to physical sensors and technology limitations [24]. As a result, pixel time series will be contaminated. Since S i,j (X) is calculated from a noisy pixel time series, S j (X) will be distorted. To take into account the noise on the pixel-entropy vector, Equation (14) can be rewritten as Equation (15), where η is a r.v. which models the noise of unknown distribution and S j (η) its associated pixel-entropy vector. A noisy pixel-entropy vector is shown in Figure 7.
To minimize the noise effects, S j (X, η) is convolved with a Moving Average (MA) filter of order N by Equation (16), where h MA is the impulse response of the MA filter. As a result of the convolution, a smoothed pixel-entropy vectorŜ j (X) is estimated which will have as many peaks as lanes and one more valleys than lanes. A smoothed pixel-entropy vector is shown in Figure 7.

Entropic Index Estimation
Since Tsallis entropy considers a system as a non-extensive through the entropic index q, its estimation is crucial for entropy calculation. A procedure to estimate q is just well-known for particular cases [25,26], so there is not a closed-form expression to estimate the entropic index for a given system.
Ramírez-Reyes et al. [6] proposed a procedure to estimate the characteristic Tsallis entropic index q of an image based on the q-redundancy maximization for a finite set of q values.
We used this methodology to estimate the entropic index from a background image I BG , estimated after a time denoted by t r for the associated video V n .

Automatic Pixel Rows Selection
Multimodal scenarios are a common environmental challenge for lane detection. Lu et al. [7] addressed this issue by detecting the horizon line (Hz) where the lane boundaries converge in a point referred to in the literature as the vanishing point of the road VP road , which partitions a W × H image into sky and road regions. Horizon line is calculated by searching for the first minimum value along the Vertical Mean Distribution (V MD) of an image [7]. First, V MD is computed by averaging the gray value of each row on the image. Subsequently, a local minimum searching algorithm is performed to find the location of the most prominent local minimum value on the V MD, where this location corresponds with Hz (see Figure 8). To process only rows of pixels located inside of the road, horizon line Hz is computed, such that the number of rows required to represent each lane center or lane division line will be H − Hz, which leads to an expensive memory footprint cost. To reduce the memory required to store the H − Hz pixel-entropy vectors and to improve the algorithm performance, only M of the H − Hz possible rows are selected. Then, M full rows of pixels are equally spaced by steps of H−Hz M , where each of these rows are indexed by:

Peak Vectors Extraction
Any theoretical pixel (see Figure 6) containing an entropy peak can be represented as a vector r = (loc, pk, w, pr), where loc ∈ R 2 is its location, pk is the pixel-entropy value, w is the peak width and pr is the peak prominence. Then, for each of the selected M rows, we have at least as many peaks vectors as number of lanes inside of the road, and other peaks outside it, which are extracted.

Peak Classification Filtering
As shown in Figure 9, not only the local maxima corresponding to the lane centers appear, but also other additional peaks can be observed: inside outside the road. One way to separate these peaks is by classification. Jacobson [27] addressed the problem of the classification of peaks by calculating the thresholds of two types of peaks. In this paper, this algorithm is implemented for the same purpose, where the classes are labeled as on road peak (RD) if their location is within the road, or as out of road peak (ORD) if their location is outside of the road. Finally, the background peaks are filtered out (see Figure 9).  It is a well-known fact that, for image analysis, the intensity values of the pixels have long-range correlations [28]. Consequently, two consecutive pixel-entropy vectors S j (X) and S j+1 (X) are highly correlated with each other for j = 1, 2, ..., H (image height). Thus, for the M selected rows, S l(k+1) (X) is an approximated scaled version of S l(k) (X). Besides, each peak vector at row (m) does not have the same characteristics of its associated peak vector at row (m + 1), as Figure 10 shows, hence an algorithm for pixel-entropy vector alignment and peak matching is required (see Figure 10).  We implement an algorithm for peak matching based on DTW. The steps of the peak matching algorithm are the following: 1. The pair of rows or pixel-entropy vectorsŜ (m) (X) andŜ (m+1) (X) are aligned by the DTW algorithm (see Section 3.3.2). As a result of the alignment, the optimal warping pathγ (m) and the distance DTW(Ŝ (m) (X),Ŝ (m+1) (X)) at rows (m) and (m + 1) are computed, whereγ (m) is the set of tuples {γ 1 (m) , γ 2 (m) , ..., γ k (m) , ..., γ K m (m) } whose domain is 1 ≤ k ≤ K m and K m ≥ W.
2. For the (m) and (m + 1) rows, a set of on-road entropy-peaks are detected and extracted. Each entropy-peak is associated with a feature vector r u (m) = (i (m) (k), (m),Ŝ i (m) (k), (m) (X), w u , p u ), where w u and p u are geometrically extracted (see Section 4.2.7). Let U be the number of on-road entropy-peaks associated to the peak-vectors r 1 (m) , r 2 (m) , ..., r U (m) at row (m), and V be the number of on-road entropy-peaks associated to the peak-vectors r 1 (m+1) , r 2 (m+1) , ..., r V (m+1) at row (m + 1), then: (a) Ideal case: U = V = L, such thatŜ (m) (X) has L on-road entropy-peaks, as Figure 6 shows.
(b) Real case: U = V, in practice more than L entropy-peaks can be detected on the pixel-entropy vectorŜ (m) (X) due to the distortion introduced by the noise (see Figure 7).
3. Once a pair of rows have been aligned, we work only with those points of the domain of the optimal warping pathγ (m) (called here k-domain) and the corresponding pair of indexes of its codomain, where live the U on-road peak-vectors of S (m) (X) and V on-road peak-vectors of S (m+1) (X). It is very important to note that the inverse of this functions is not a function but a relation, i.e., to each of the U or V peak-vectors corresponds one or more k values, denoted as k(u) and k(v), respectively, that together build two sets {k(u)} (m) , {k(v)} (m+1) of cardinality N u and N v , respectively (see Figure 12). In Figure 12, for the peak-vectors r 1 (m) and r 1

The associated vector is r u
the location in the background image of a pixel that probably belongs to the l-th lane center or φ n u, (m) and the pair of pixels (φ n u, (m) ,φ n v, (m+1) ) builds a possible segment of the lane center L c (l). Then, given two peak-vectors r u (m) and r v (m+1) , we say that r u is related with by the minimal distance d(r u (m) , r v (m+1) ) in the k-domain defined as: It is obvious that d(r u (m) , r v (m+1) ) = 0, iff ∃!k ∈ k-domain : γ k (m) = (i u (m) , i v (m+1) ), then it is said that r u (m) and r v (m+1) are matched, and, in other cases, are associated.
In the ideal case, ∀r u (m) ∈ U and r v (m+1) ∈ V, d(r u (m) , r v (m+1) ) = 0, there is a one-to-one correspondence between the U and V peak-vectors. However, for the real case, the correspondence of the U and V peak-vectors is not always one-to-one, that is, sometimes they are matched, and sometimes they are associated only (see Figure 12).

5.
For each m-value, m = 1, 2, ..., M − 1, all possible relations between pairs of peak-vectors (r u (m) , r v (m+1) ) can be represented by a cost matrix ξ of size U × V (Equation (20)), where each element ξ u,v = d(r u (m) , r v (m+1) ) is calculated by Equation (18). The pairs of on-road peak-vectors are selected according to the following rules: (a) For each v-column of ξ, a peak-vector r v (m+1) is matched or associated with a peak-vector r u (m) , if its distance is minimal for the whole column.
(b) Finally, if there are two or more peak-vectors in row (m) or (m + 1) that are related to the same peak-vector in the other row, i.e., (m + 1) or (m), our algorithm selects the one with the greatest peak width, so noisy peaks will be filtered automatically.
For each j: In general, for each m-value ξ has the form: (a) Ideal case: The size of ξ is L × L, with zeros on the main diagonal and values corresponding to multiples of the lane width L w elsewhere as Equation (21).
(b) Real case: The size of ξ is U × V, the distances d(r u (m) , r v (m+1) ) are calculated and the selection rules 5a) and 5b) are applied.
An example of a cost matrix between the rows (M − 1) and (M) of Figure 13 is shown in Equation (22) 6. For each m value indexing (S (m) (X), S (m+1) (X)), each selected pair of peak-vectors is stored in a pathL c (n, (m)) (see Equation (23)), which is updated for the next m = m + 1 repeating Steps 1-6, and the estimated lane center is given by the set of the selected pairs of peak-vectors.
L c (n, (m)) = {(r i (m) , r j (m+1) ), (r j (m+1) , r p (m+2) )} (23) or by the ordered set of the corresponding locations: where n is the lane center number, and whereφ n i,j represents the estimated location of the pixel (i, j) in the background image, belonging to the n-th lane. (c) The length of each laneL c (n, (m)) is given by the sum of the lengths of each segment determined by (r i (m) , r j (m+1) ).
Each path L c (n, (m)) must satisfy the following conditions (see Figure 14): 1. A path must contain at least a certain minimum number of points, e.g., 3 in our case. 2. A path does not have a gap, and each path must be continuous.
Therefore, the described algorithm allows obtaining automatically not only the lane center paths, but also the number of lanes of any road. Each pathL d (r, (m)) is fitted by a second-degree polynomial using L(n) = {(x, y) ∈ R 2 |y = p (n) (x) = a 0 + a 1 x + a 2 x 2 } to model a lane division line as a pathL d (r). Importance of the algorithm for other approaches Whenever entropy variations can be mapped or correspond to certain regions of interest, the use of pixel entropy concept can be used as basis for the development of new algorithms, e.g., monitoring of certain activities for video applications.

Test Videos and Environment
To evaluate the performance of the proposed algorithm, a large dataset consisting of 12 surveillance videos with different challenging scenarios such as image illumination, camera settings, traffic load per-lane and with other moving objects such as pedestrian and waving vegetation were used. The set of test videos have more than 2340 s of traffic scenes previously recorded from a surveillance camera and a smart phone with a resolution of 420 × 240 pixels and a frame rate of 25 frames per second (FPS). Figure 16 shows the background images of the test videos previously extracted, while Table 1 summarizes relevant technical data of the test videos.
The lane detection algorithm was implemented in Matlab running on a dual core 2.4GHz intel core i5 machine with 8GB of RAM. The transition time t r was fixed empirically to 30 s based on the assumption that the traffic load is 1 vehicle/s per-lane, while the update time t u to 1 s for a fast lane update. Finally, the number of bins of each histogram was fixed to 20 while the moving average filter length to 10. The lane centers and lane division lines were extracted geometrically based on the pavement markings. Consequently, they do not show some of the drivers' dynamic behaviors.

Pixel-Entropy Measurements
To validate the assumptions about the pixel-entropy behavior, a set of measurements were taken. First, three pixels time series from video V7 were extracted. Next, their histograms were computed with nbin = 20, following by the calculation of the cumulative Shannon and Tsallis entropies and the entropic indexq, as in Section 4.2.5. Figure 17 represent the pixel time series x t (i, j), the pmf f X (x), and the cumulative Shannon and Tsallis pixel-entropy, while each row represents theoretical pixels.
We performed several experiments on different scenarios and pixel positions. A heat map visualization (see Figure 18) allows comparing multiple pixel-entropy levels validating our assumptions about the pixel-entropy behaviors. We observe that, for a traffic load of one vehicle/s per-lane, the pixel-entropy converges around 800 frames (32 s).

Entropic Index Estimation
To estimate the entropic index, a finite set of q-values ∈ R must be given and its evaluation is a very consuming task. Following the methodology in Section 4.2.5, we performed several experiments on different pixel-entropy vectors with different sets of q-values and number of microstates (see Figure 19). The experimental results allowed us to determine a finite set of q-values based on the Tsallis entropy behavior and the estimated entropic indexq = 0.42.

Lane Detection Results
The performance of our algorithm was evaluated comparing the error of the estimated lanes using both Shannon and Tsallis entropy with an algorithm based on trajectories [13,14].
For a detected lane, a good estimate of its center and division lines must reach a high precision, and cover the greatest possible length of the referenced lane. The Absolute Error at Pixel-level (AEP) metric [14] based on the Hausdorff distance was used to compare the lane position error between the positions of a reference lane center/division line and the corresponding estimated positions (see Equation (27)). It is understood that a good lane center or lane division line estimate has a low AEP.
where L(n) andL(n) contain the pixel positions (x a , y a ) of the k th real lane position and the corresponding estimated positions (x a ,ŷ b ), respectively. Table 2 reports the evaluation of the lane detection stage using the classical metrics (Equations (28) Our algorithm detected 38 of 44 lane centers successfully, while trajectory-based achieved only 22 detections. The average detection rate of 86.36% were achieved by the proposed algorithm compared to the 50% of the trajectory-based algorithm. Our algorithm outperforms significantly the detection failures of trajectory-based methods caused by lower number of well-formed trajectories. The average computing time to process a frame takes about 400 µs, and for a pixel row of 420 pixels 40 µs. The total computing time to process 10 pixel rows takes about 65 ms. Our algorithm is 98.62% faster than the one in [14] for processing each frame, and 50.38% faster than the one in [14] for performing an iteration to estimate both the lane centers detection and the lane division lines formation. Figure 20 shows the qualitative results for the lane detection stage of the scenarios and the second order approximations of the estimated lane centers of our algorithm using Shannon (green) and Tsallis entropy (red), as well as the trajectory-based lane centers (blue). In Figure 20a, lane centers positions of the test methods have almost the same bias; however, the lane length covered by our algorithm is much greater than those covered by trajectory-based algorithms. In Figure 20, the trajectory-based algorithm could not detect any lane center due to the lack of trajectories, mostly because of the camera height and the illumination conditions. In Figure 20, our algorithm could not detect the left lane center due to the lack of traffic flow on this lane. Figure 20 shows a high and slow traffic load per-lane, trajectory-based is not suitable in this situation but our algorithm provides a good estimate of the lane center. Figure 20 shows a notable bias for all tested algorithms in the fourth lane due to the driving behavior on this lane. Finally, for all test scenarios, it is shown that the lane coverage by our algorithm is greater than the trajectory-based algorithm. Table 3 reports quantitative results of the lane center detection based on the AEP metric (Equation (27)), where the best estimate of each lane center is highlighted in bold. For all tested videos except for the video V6, our algorithm outperforms the trajectory approach with lower AEP of up to 32.33%, less than trajectory AEP with an average of 18.57%. For cases where the performance of our algorithm could not overcome the trajectory-based methods, AEP of up to 11.29% was achieved with an average of 7.34%. For all videos, the lane coverage of our algorithm is greater than the trajectory approach.    Table 4 reports quantitative results of the lane division line formation based on the AEP metric (Equation (27)). Shannon results are omitted because they are similar to Tsallis. A fair comparative against lane marking-based algorithms cannot be achieved because to road marking performs a detection of the static lane division lines, whereas our algorithm performs the dynamic lane division lines formation, and these two types of lane division lines are not necessarily equal in position and in number.

Discussion
Test environment. Several test scenarios with more than 20, 000 frames were analyzed, at seven places in different countries, and average traffic loads from 0.40 to 1.69 were used.
Pixel-entropy. Shannon and Tsallis entropies were used. Tsallis achieves better results with q =q. Under a traffic flow of one vehicle/s, entropy values converges in 32 s to stable values.
Tsallis entropic index q. Experimental results show that the range of the q for the entropic index estimation is (0 + , 1), with = 0.1. For the test videos, q-values close to 0.42 were estimated.
Lane detection. For the detection stage, our algorithm achieved a high lane detection rate and the highest precision of up to 100% for most scenarios. It was observed that paths with at least five peak vectors were highly reliable.
Peak matching based on k-means. k-means algorithm was employed to cluster a subset of the peak-vectors (i, j, pk) into L lane centers and L + 1 lane division lines. K-means did not perform well, mostly due to the lack of large amount of samples, noise and outliers. The algorithm cannot perform an automatic detection of lanes number because it requires an input parameter K that determines the number of lanes to be found, therefore a priori knowledge of the scenario is necessary.
Peak matching based on DTW. the DTW algorithm was employed to select relevant on-road peak vectors for lane centers and lane division lines. It was the algorithm with the best performance achieving the lowest AEP (see Table 3).
Driving behavior. It was observed in several videos that on lateral lanes the estimated lane centers are displaced relative to the geometric lane centers due to driver behaviors.
Limitation. For very low traffic load in short time periods, the algorithm showed the lowest performance.

Conclusions
In this paper, a novel and high-performance algorithm for the number of lanes and their centers detection, as well as lane division lines formation based on pixel entropy is presented. To the authors best knowledge, the use of entropy for this purpose has not been done before.
One of the most remarkable features of this algorithm is the automatic detection of all dynamic lanes using the DTW algorithm, without knowledge a priori of the number of lanes, making it highly robust to challenging scenarios where the lane and the number of lanes can change.
Experimental results with real data prove that our algorithm outperforms those based on trajectories with respect to computational time for lane description extraction and precision of lane centers significantly, including scenarios with high congestion, partial occlusion, waving vegetation and several perspective views.
Unlike traditional lane division line detection algorithms, which are based on road marking detection, our algorithm performs lane division line formation.
For lane center detection and under the same traffic load conditions, our algorithm shows the lowest computational time.
Open Issues