A compact algorithm for rectification of stereo pairs