Problems of segmenting time series or digital images are considered. In both cases the observations fall into classes, and this assignment of observations to classes, or "labelling," is unknown. Thus each point gives rise to a pair, the observation itself, together with its unknown label. In the context of this model, segmentation is estimation of the labels. In time series the points are time points; in digital images, the points are points of the image (picture elements, or pixels).