With the advent of the driverless cars, the importance and accuracy of lane detection has achieved paramount importance in the field of perception and imaging. In this paper, we propose an algorithm to achieve lane detection on roads using the real-time data gathered by the camera
and applying K-means clustering method to report data in a manner suitable to create a solvable map. The proposed method uses the physical nature of the data to cluster the data. Silhouette coefficient is used to determine the number of clusters in which the data should be divided. Lanes are
interpolated to get the correct markings. We demonstrate the efficacy of, the proposed method using real-time traffic data to noise, shadows, and illumination variations in the captured road images, and its applicability to both marked and unmarked roads.