This paper proposes a real-time collision warning system for the front of a vehicle, which contains three stages: lane marking detection, vehicle detection, and vehicle distance estimation. Sobel edge detection and Hough transform techniques are used in the lane marking detection stage to extract lane marking information. In the vehicle detection stage, two very different situations are considered: daytime and nighttime. In the daytime, two kinds of features, vehicle shadows and horizontal edges, are extracted to detect the locations of vehicles. These two features can respectively be obtained by Otsu's method and a horizontal edge detection method. For the nighttime or in days of poor visibility, vehicle tail light features are used to detect the location of vehicles. These features can be obtained from the Cr component of the YCrCb color model and the hue component of the Hue, Saturation and Intensity (HSI) color model respectively. In the vehicle distance estimation stage, the system estimates the distance between the host vehicle and the front vehicles using exponential functions. Some warning messages will be output to the drivers if necessary. In this study, a recorder is set on the front windscreen to obtain the input sequences. The experimental results show that the proposed method has great stability and usability. We intend for the proposed method to be embedded into driving assistance systems and installed in vehicles in the future.