A Latent Source Model for Patch-Based Image Segmentation