Processing a sequence of images