Multi-Layer Surface Segmentation for Range and Stereo Images