2
$\begingroup$

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

$\endgroup$
2
  • 1
    $\begingroup$ 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. $\endgroup$ – J. M.'s ennui Oct 25 '17 at 8:29
  • 1
    $\begingroup$ @J.M. sure, I added a link in the description $\endgroup$ – james Oct 25 '17 at 8:35
3
$\begingroup$
Split[Range @ Length @ similarImages, 
  ImageDistance[similarImages[[#]], similarImages[[#2]]] <= 100 &][[All, {1, -1}]] /. 
 {x_, x_} :> {x}

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

$\endgroup$
2
  • $\begingroup$ Awesome !! Thank you very much! $\endgroup$ – james Oct 25 '17 at 9:03
  • $\begingroup$ @totyped, my pleasure. Thank you for the accept. $\endgroup$ – kglr Oct 25 '17 at 9:25
0
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ Thank you for the answer. However, I cannot find FeatureExtraction on my Mathematica (10.4). $\endgroup$ – james Oct 25 '17 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.