We consider an abstract concept of perimeter measure space as a very general framework in which one can properly consider two of the most well-studied variational models in image processing: the Rudin–Osher–Fatemi model for image denoising (ROF) and the Mumford–Shah model for image segmentation (MS). We show the linkage between the ROF model and the two phases piecewise constant case of MS in perimeter measure spaces. We show applications of our results to nonlocal image segmentation, via discrete weighted graphs, and to multiclass classification on high dimensional spaces.