Photo Morph Sorter

Given a randomly selected stack of photos, an algorithm could put them in order such that they appear to be morphing. What’s creative is that the morphing would be done without transforming any of the images.

Here’s a black car turning into a white cat.

Implementation

The simplest algorithm would start with a set of random images and a similarity score between every pair of images, and a randomly chosen starting image. Then, given any previous image, the next would be the most similar unused one.

Choosing the starting image at random will lead to missed opportunities. In the example sequence above, if it had started with any image but the black car, the black car would have been left until last, and ended up appearing after the white cat. This would make no sense visually. It would create a breaking point in the sequence where everything went off the rails.

A different algorithm:

Start with a set of random images, a similarity score between every pair of images, and a randomly chosen starting image. Then, for any unused image, insert it into the sequence at the point where the sum of the distances between the inserted image and the adjacent ones is smallest.

However, at each step you might be planting problems for later. Another strategy would be to invent a metric for the chain as a whole, start to finish, and use a Markov Chain to find the optimal sequence.

(Idea for the metric:

  1. sum of all pairwise distances. This would capture places where a choice earlier forced a bad selection later
  2. largest jump between any pair of images).

Ok, I have to go to work. This has been an entry in an open notebook.

Leave a Reply

Your email address will not be published. Required fields are marked *