I have two images: im1,im2. When I compute their distance, using ImageDistance[im1, im2] I get a value. However, I would like to normalize this value... So do you know what the maximum image distance can be?


This is so strange: I have two images...

{i1, i2} = {im1, im2}
ImageDistance[i1, i2, DistanceFunction ->NormalizedSquaredEuclideanDistance]

I always get close to 0.5, but the variations when not using the nomalized euclidean distance are much wider. Therefore, is it possible to know the maximum euclidean distance ?

  • $\begingroup$ maybe DistanceFunction -> NormalizedSquaredEuclideanDistance? $\endgroup$ – kglr Aug 8 '18 at 8:59
  • $\begingroup$ @kglr This always results in 0.5, whatever pictures I use $\endgroup$ – james Aug 8 '18 at 9:08
{i1, i2, i3, i4} = ExampleData[{"TestImage", #}] & /@
   {"Lena", "Mandrill",  "JellyBeans", "JellyBeans2" };
ImageDistance[##, DistanceFunction -> NormalizedSquaredEuclideanDistance] & @@@ 
 Subsets[{i1, i2, i3, i4}, {2}]

{0.462035, 0.456534, 0.450411, 0.518159, 0.544553, 0.205007}

i5 = RandomImage[1, {100, 100}];
i6 = Image[1 - ImageData[i5]];  
ImageDistance[i5, i6, DistanceFunction -> NormalizedSquaredEuclideanDistance] 


  • $\begingroup$ Thanks a lot. See the edit... $\endgroup$ – james Aug 8 '18 at 9:40

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.