## 3 Proposed Method
### Lane-Candidate Grouping and Optimal Lane Detection and Tracking
#### 3.2.2 Restriction System and Lane Tracking  
As the subsequent step, the final lane is determined through the process depicted in Figure 15, starting from the lane-candidate group obtained using the Hough transform. Figure 13: A comparison for determining the appropriate parameters of an MSR at nighttime (The red lines indicate the position of the lane profile, and the red dots represent the boundary of the lane edge): (**a**) High bilateral filter parameters and MSR with uniform weight on sigma; (**b**) image (**a**)’s lane-line profile; (**c**) high bilateral filter parameters and MSR with higher weight on low sigma; (**d**) image (**c**)’s lane-line profile; (**e**) high bilateral filter parameters and MSR with higher weight on high sigma; and (**f**) image (**e**)’s lane-line profile. The angle and distance restrictions in this paper are determined based on the experimental results shown in Figure 16. The experiment involved analyzing 1000 images. Figure 16 displays the outcome of applying k-means clustering to the point cloud representing the detected lanes. The scattered points represent the angles and distances of the lanes detected by this method without the restriction system. The angle (\(\theta\)) and distance (\(D_{dist}\)) are calculated using Equations (4) and (5), respectively. \[\theta=\|\tan^{-1}\frac{y_{line}}{x_{line}}\|, \tag{4}\]  
\[D_{dist}=\|\frac{C_{line}-C_{img}}{W_{img}}\|, \tag{5}\]  
where \(y_{lane}\) is the line height, \(x_{line}\) is the line width, \(C_{line}\) is the coordinate of the line's center point, \(C_{img}\) is the coordinate of the image's center point, \(w_{img}\) is the image's width length, and \(D_{dist}\) indicates the distance of the lane from the center of the image. Figure 14: The image created by applying the Canny edge detection to generate an edge image and detecting lane candidates using the Hough transform: (**a**) a sample with no interfering factors present in the driving area; and (**b**) a sample with interfering factors present in the driving area. Figure 15: Detailed description of the restriction system at each stage (yellow line: Lane candidates, red line: Selected lane from lane candidates, green line: Lane initially selected from lane candidates but restricted due to being too close to the center, blue line: Lane with corrected position using Kalman Filter from the selected red lane.). The k-means clustering algorithm is used in this study to group the data into k clusters based on minimizing the variance of the distance between each cluster [35]. The light-green cluster in the k-means clustering result is considered as the lane distribution. To improve the lane-detection rate, the angle (\(\theta\)) and distance (\(D_{dist}\)) are restricted to a range of 0.4 to 0.8 and 0.06 to 0.4, respectively. These constraints increase the probability of detecting the actual lanes among the detected lines. While these restrictions are stringent, it is possible that a lane may not be detected in a single frame. However, the Kalman filter is used to estimate the lane based on the information from previous frames. In the previous step, two lanes are obtained and updated using the Kalman filter. This lane information is used for the Kalman prediction in the next frame. The lane information also corrects the estimated lane from the previous frame using the currently observed information [11]. In cases where an appropriate lane is not detected in the current frame due to strong external light interference, the Kalman tracking result from the previous frame is used. When the Kalman filter is updated and lane information is not detected in the current frame, the lane of the current frame is estimated using only the previous data without a correction value. However, due to the robustness of the Kalman filter, stable detection and tracking are possible under certain frame conditions as long as the lane does not change abruptly.