Solved – Statistically compare similarity between images

heatmapimage processingmachine learningpythonsimilarities

I have two images/heatmaps (2d matrix) of identical size. I need to statistically compare the similarity between the two. With 'similarity', I mean that high and low values of one image appear in similar areas in the other image.

Does anyone have an idea on how to do this? (I am using Python.)

Best Answer

You are comparing distributions over a two-dimensional grid. A very common way to do this is the Earth mover's distance, also known as the Wasserstein metric. (You may need to normalize your images first.)

In looking for an implementation, you need to make sure it works with two dimensional data - many are restricted to one dimensional histograms. However, there seem to be multiple Python implementations you could use.