# List of same images -> Find intervals of same images

I have a list of images. There are some similar ones. Now, I would like to create a list, wich tells me the interval of those similar images. How can I do it ?

For instance:

and the result should be:

intervalSimIm = {{1,6},{7},{8,11},{12}}


Here are the images, if you want to try it out: https://www.dropbox.com/sh/arp1v6i3a7hp802/AADy3XfJ2WxSOqnMBnTBJbaWa?dl=0

• Can you zip up the images you have and put it on e.g. Dropbox? Other people can't experiment if they don't have your images. Commented Oct 25, 2017 at 8:29
• @J.M. sure, I added a link in the description Commented Oct 25, 2017 at 8:35

Split[Range @ Length @ similarImages,
ImageDistance[similarImages[[#]], similarImages[[#2]]] <= 100 &][[All, {1, -1}]] /.
{x_, x_} :> {x}


{{1, 6}, {7}, {8, 11}, {12}}

• Awesome !! Thank you very much! Commented Oct 25, 2017 at 9:03
• @totyped, my pleasure. Thank you for the accept.
– kglr
Commented Oct 25, 2017 at 9:25

ImageDistance hard to work on more complicated case. There are two methods maybe can give more stable result, and it can make you leave those magic threshold.

imgs = Import["E:\\download\\Similar_images.zip", "*.png"];


## Mehtod one

FindClusters[MapIndexed[# -> First[#2] &, imgs]]


{{1,3,4,5,6,7,8,9,11,12},{2},{10}}

## Method two

This will cost your more time, but I think it is stronger.

fe = FeatureExtraction[imgs];
fd = FeatureDistance[fe];
FindClusters[MapIndexed[# -> First[#2] &, imgs], DistanceFunction -> fd]


{{1,3,4,5,6,7,8,9,11,12},{2},{10}}

• Thank you for the answer. However, I cannot find FeatureExtraction on my Mathematica (10.4). Commented Oct 25, 2017 at 12:54