1. A computer implemented method of segmenting image elements in each of a pair of stereo images into at least two segments being a foreground and a background said method comprising: defining an energy function for probabilistic stereo matching; approximating the energy function to require computation only over foreground disparities; and using an optimization algorithm on the approximated energy function to achieve the segmentation.