Sequence matching of images