A numerical approach to a minimum problem with applications in image segmentations