Fragments with similar borders (but from different images) are put next to each other to create a “composite picture”. For similarity, I am using (negative of) the L1 distance between the pixels of two images in a small strip around the borders.
We start with a whole picture, and insert fragments clockwise.
and keep going
and going until a steady state has been reached
Just for kicks, a downtown Pittsburgh picture:
The code can be found here.