This paper presents a new stereo algorithm for computing dense disparity maps from stereo image pairs by a global cost relaxation, realized as an optimization problem, where the disparity map is the momentary state of a dynamic process. Following the natural role model of the human visual system, we assign a set of possible disparities to each image pixel described by cooperating probability variables. In the first step a correlation-based similarity measure is performed to initialize the relaxation process. The relaxation itself is formulated as an optimization of a global cost function taking into account both the stereoscopic continuity constraint and considerations of the pixel similarity. A special formulation guarantees the existence of a unique cost minimum which can be easily and rapidly found by standard numerical procedures. In a post-processing step, occluded areas are detected and a sub-pixel precise disparity map is computed.