Stereo correspondence is one of the most active research areas in computer vision. It consists in identifying features in two or more stereo images that are generated by the same physical feature in the three-dimensional space. In our approach, the matching problem is first turned into an optimization task where a fitness function, representing the constraints on the solution, is to be minimized. The optimization process is then performed by means of a genetic algorithm with a new encoding scheme. Experimental results are presented to demonstrate the robustness and the reliability of the proposed approach for obstacle detection in front of a vehicle using linear stereo vision.