Stereo matching based on edge segments