Most simplest way how to solve this in two images
is extract the values from both rasters and do correlation.
I am not sure if this solution will fit to your spacific case.
In what "format" do you have the images? (greyscale, RGB, size, resolution...).
Please give more specific details.
Two rasters in R for demonstration:
Values for picture A:
x <- c(1.0,1.0,1.0,1.0,0.5,0.5,0.0,0.0,0.5,0.5,
2.0,2.0,1.5,1.5,1.0,1.0,0.5,1.0,1.0,1.0,
2.5,2.0,2.0,2.0,2.0,1.0,1.0,1.5,2.0,2.0,
2.5,3.0,3.0,3.0,2.5,2.0,2.0,2.0,2.5,2.5,
2.5,3.5,4.0,3.5,2.5,2.0,2.5,3.0,3.0,3.5,
2.5,3.5,3.5,2.5,2.0,2.5,3.0,3.5,4.0,3.5,
2.5,3.5,3.5,3.0,3.5,4.0,4.0,4.0,3.5,2.5,
2.5,3.5,4.0,4.0,3.5,3.5,3.0,3.0,2.5,2.0,
2.5,3.5,3.5,3.0,2.5,2.5,2.0,2.0,2.0,1.5,
2.0,3.0,2.5,2.0,2.0,1.5,1.5,1.5,1.0,1.0)
Values for picture B:
y <- c(rep(1, times = 10),
rep(2, times = 6), 1, rep(2, times = 3),
rep(2, times = 10),
rep(3, times = 4), rep(2, times = 4), 3,3,
3,4,4,3,2,rep(3, times = 4), 4,
3,4,rep(3, times = 5), rep(4, times = 3),
3,4,3,3,3,4,4,4,3,3,
3, rep(4, times = 4), rep(3, times=4), 2,
3,3,4,3,3,3,rep(2, times = 4),
2,3,3,3,rep(2, times = 6))
Creation of arrays -> conversion of arrays into rasters
x_array<-array(x, dim=c(10,10))
y_array<-array(y, dim=c(10,10))
x_raster<-raster(x_array)
y_raster<-raster(y_array)
Setting color palette and plotting...
colors_x <- c("#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497",
"#ae017e","#7a0177","#49006a")
colors_y <- c("#fff7f3","#fcc5c0","#f768a1","#ae017e")
par(mfrow=c(1,2))
plot(x_raster, col = colors_x)
plot(y_raster, col = colors_y)
...and here is the correlation
cor(x,y)
Pearson's product-moment correlation
data: x and y
t = 21.7031, df = 98, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.8686333 0.9385211
sample estimates:
cor
0.9098219
Maybe there is more specialized solution to this but I think that this solution
is pretty robust, simple and straightforward.
Link worth of interest: (for ImageJ
)
http://imagej.nih.gov/ij/plugins/intracell/index.html
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.