Stereo correspondence using a three-camera model and dynamic programming