2

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:

enter image description here

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

kglr
  • 394,356
  • 18
  • 477
  • 896
james
  • 3,043
  • 13
  • 29

2 Answers2

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

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

kglr
  • 394,356
  • 18
  • 477
  • 896
0

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}}

yode
  • 26,686
  • 4
  • 62
  • 167
  • Thank you for the answer. However, I cannot find FeatureExtraction on my Mathematica (10.4). – james Oct 25 '17 at 12:54