Collisions arising from lane departures have contributed to traffic accidents causing millions of injuries and tens of thousands of casualties per year worldwide. Many related studies had shown that single vehicle lane departure crashes accounted largely in road traffic deaths that results from drifting out of the roadway. Hence, automotive safety has becoming a concern for the road users as most of the road casualties occurred due to driver's fallacious judgement of vehicle path. This paper proposes a vision-based lane departure warning framework for lane departure detection under daytime and night-time driving environments. The traffic flow and conditions of the road surface for both urban roads and highways in the city of Malacca are analysed in terms of lane detection rate and false positive rate. The proposed vision-based lane departure warning framework includes lane detection followed by a computation of a lateral offset ratio. The lane detection is composed of two stages: pre-processing and detection. In the pre-processing, a colour space conversion, region of interest extraction, and lane marking segmentation are carried out. In the subsequent detection stage, Hough transform is used to detect lanes. Lastly, the lateral offset ratio is computed to yield a lane departure warning based on the detected X-coordinates of the bottom end-points of each lane boundary in the image plane. For lane detection and lane departure detection performance evaluation, real-life datasets for both urban roads and highways in daytime and night-time driving environments, traffic flows, and road surface conditions are considered. The experimental results show that the proposed framework yields satisfactory results. On average, detection rates of 94.71% for lane detection rate and 81.18% for lane departure detection rate were achieved using the proposed frameworks. In addition, benchmark lane marking segmentation methods and Caltech lanes dataset were also considered for comparison evaluation in lane detection. Challenges to lane detection and lane departure detection such as worn lane markings, low illumination, arrow signs, and occluded lane markings are highlighted as the contributors to the false positive rates.