Dense terrain stereoreconstruction using modified SGM