1. A computer-implemented method comprising: performed by one or more processors executing computer-readable instructions, receiving one or more input images; for each input image, specifying an initial offset map comprising a mapping of image elements from the input image onto an initialized output image; specifying a joint probability distribution on the output image, the input images and the offset maps such that the joint probability distribution comprises a neighborhood constraint such that the repeated-structure elements tend to be learned such that their size is as large as possible while still enabling the repeated-structure elements to describe as many regions in the input image(s) as possible; optimizing the joint probability distribution to find a learned output image and offset maps, the learned output image comprising learned repeated-structure elements having variable shape, size and appearance; and outputting the learned output image and offset maps.