Using disparity functionals for stereo correspondence and surface reconstruction