Image segmentation as an estimation problem