A Contrario Selection of Optimal Partitions for Image Segmentation