Most traffic accidents resulted from distraction, inattention to surrounding cars, and driving fatigue. In order to protect drivers, a real-time lane-detection and front-vehicle distance measurement system that uses a mounted camera inside a vehicle has been designed for safe driving. For lane detection, the lane-boundary information is derived from the fan-scanning-detection method. The system calculates the departure degree according to the angular relationship of the boundaries and sends a suitable warning signal to drivers. For front-vehicle distance measurement, we use the front vehicle's shadow underneath it to identify the position of the front vehicle. The real distance is estimated by the use of the functional neurofuzzy network. The experimental results show that the system works successfully in real-time environment.