A locally global approach to stereo correspondence