Lane keeping assistance systems help the driver in following the lane centerline. While lane keeping assistance systems are available in some mass production vehicles, they have not found widespread use and are not as common as ESP or ACC at the moment. Lane keeping assistance systems still need further development. Previously available systems have to be continuously adapted to newer vehicle models and fully tested after this adaptation. An image processing algorithm for lane detection and tracking, a lane keeping assistance controller design and a real time hardware-in-the-loop (HiL) simulator developed for testing the designed lane keeping assistance system are therefore presented in this paper. The high fidelity, high order, realistic and nonlinear vehicle model in Carmaker HiL runs as software in a real time simulation on a dSpace compact simulator with the DS1005 and DS2210 boards. A PC is used for processing video frames coming from an in-vehicle camera pointed towards the road ahead. Lane detection and tracking computations including fitting of composite Bezier curves to curved lanes are carried out on this PC. In the present setup, the camera used is a virtual camera attached to the virtual vehicle in Carmaker and provides video frames from the Carmaker animation screen. A dSpace microautobox is available for obtaining the lane data from the PC and the Carmaker vehicle data from the dSpace compact simulator and calculating the required steering actions and sending them to the Carmaker vehicle model. The lane keeping controller is designed in the Matlab toolbox COMES using parameter space techniques. The motivation behind this approach is to develop the lane keeping assistance system as much as possible in a laboratory hardware-in-the-loop setting before time consuming, expensive and potentially dangerous road testing. Lane detection, tracking and curved lane fit results, hardware-in-the-loop simulation results of the lane keeping controller with the image processing system are are used to demonstrate the effectiveness of the proposed method.