Clustering Under Prior Knowledge with Application to Image Segmentation