I would like to compute the similarity/dissimilarity between two images L and R.

I know one way which is : computing the histogram of blocks of each image, and then using Bhattacharyya measure I asset if the blocs are similar or not. The histogram are normalized the result are between 0 and 1. The reference to this is on this article :

Bhattacharyya, A., “On a measure of divergence between two statistical populations defined by their probability distribution,” Bulletin of the Calcutta Mathematical Society 35, 99–110 (1943).

Well, I know that there is other measures (MI, Tanimoto, etc) and I would like to know if there is other ways to compute the Similarity/Dissimilarity between two images. I mean using histograms , it is kind of region based similarity measure, but is there some pixels related similarity techniques or more region based ones ?

Update 1

To illustrate what I want, here is an example of two images to be compared. As you can see it is related to medical imaging (here there is two parts of the brain but I am talking about a more general case) :

enter image description here

enter image description here

If only I can get a MAP of simmilarity/dissimilarity between those two images. The technique I proposed above works fine , but i am requesting some references for other similar techniques.

  • 2
    $\begingroup$ You might look at the SSIM: Structural Similarity measure. $\endgroup$ – Joseph O'Rourke Jun 10 '15 at 9:54
  • 5
    $\begingroup$ The effectiveness of the measure would depend on the kind of image you are dealing with. You could be comparing human faces, or satellite imagery etc. It is not entirely mathematical. $\endgroup$ – Rajesh D Jun 10 '15 at 9:57
  • $\begingroup$ @RajeshD is right. Similarity with respect to what? $\endgroup$ – Włodzimierz Holsztyński Jun 10 '15 at 10:26
  • 1
    $\begingroup$ Have you tried the "measure of similarity of images" googling? The search brings 426000000 pages. $\endgroup$ – user64494 Jun 10 '15 at 18:08
  • 3
    $\begingroup$ Opened a meta thread to discuss this question being constituted as mathematics. meta.mathoverflow.net/q/2303/14414 $\endgroup$ – Rajesh D Jun 14 '15 at 16:09

One particular application to medical scans, that may be relevant for your problem, is the alignment and fusion of information in images of the same tissue obtained by different methods (MRI, CT, ultrasound). This application goes by the name of image registration, and it has a very extensive literature, with a variety of software tools that you can download.

In this paper, eight intensity-based similarity measures for CT and ultrasound scans are evaluated. Six of these use the information from the histogram of images while two of them use the spatial information and intensity values. They are: mutual information, normalized mutual information, entropy correlation coefficient, joint entropy, point similarity measure based on mutual information, histogram energy, correlation ratio, and Woods criterion. Each intensity-based similarity measure was assessed for its capability to align and fuse complementary information in CT and ultrasound images. We compared its accuracy, capture range, distinctiveness of the optimum, risk and non-convergence, and number of minima.

  • You can find algorithms for some of these similarity measures in a Matlab toolbox.

Have you tried G-H similarity measure? Check this paper: http://sites.fas.harvard.edu/~cs277/papers/gromov.pdf Memoli 2007


A quite naive method would be to create an image, where each pixel-value equals the "distance" between the corresponding pixels of the source images, i.e. $r(x,y) := \vert p(x,y)-q(x,y)\vert$ and check the size of the compressed "difference image".
The smaller the size of the compressed difference-image, the closer are the source images.

That approach can however not unveil semantic similarity; but as it is fairly simple to implement, it should be a good start.
One could different kinds of compression (e.g. lossy and lossless) and pick the most suitable one. Simply storing the difference image in various image-file formats might already suffice.


seeing the medical application of similarity detection, I can imagine that the true underlying use case actually is a classification or, recognition problem.
There are other problems, that seem to be of similar nature:

  • Face Recognition and Optical Character Recognition; those are commonly solved successfully with Neural Networks.

  • Morphological Similarity; there a classical method is the Thompson Transform first presented in Thompson's On Growth and Form

I found Ardeshir Goshtasby's chapter about Similarity and Dissimilarity Measures quite useful.

  • $\begingroup$ Interesting, but it is the most obvious method. In my case it won't "really" work. Because the registration is not 100% good .... But it is another way to check dissimilarity. Thank you for your contribution. $\endgroup$ – user74794 Jun 12 '15 at 17:15
  • $\begingroup$ @OSryx without having concrete examples of pictures that should be classified similar or dissimilar and without any hint about the background of your question, it will be hard to suggest something more elaborate. The only other generic method I can think of, would be to train a neural network. $\endgroup$ – Manfred Weis Jun 13 '15 at 6:21
  • $\begingroup$ I see, I updated my question with two pictures that show two blocks of a medical image (normal brain). I would like to compare them. I hope I am more clear now, please feel free to ask more questions so that I make my question more "good". How can we use NN to compare two images please ? $\endgroup$ – user74794 Jun 13 '15 at 8:24
  • $\begingroup$ can you add the NN similarity technique to your answer ... please $\endgroup$ – user74794 Jun 13 '15 at 8:27
  • 1
    $\begingroup$ @OSryx I just added two new ideas to my answer; Please note, that I have no expertise in either of the methods, but maybe some other MO user can jump in. I merely wanted to open new views on your problem. $\endgroup$ – Manfred Weis Jun 13 '15 at 13:53

Your Answer

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