Variational Image Segmentation and Cosegmentation with the Wasserstein Distance