Compute variance between two images
Posted: 2010-09-01T20:24:31-07:00
I'd like to make a sort of fuzzy compare between two images (A and B, with dimensions x,y). In order to do this I'd like to compute the variance between the two images where
variance = sum over (x,y) { [red(A(x,y))-red(B(x,y))]^2+[green(A(x,y))-green(B(x,y))]^2+[blue(A(x,y))-green(B(x,y))]^2 }/(x*y)
I think there must be a reasonably quick way to do this but thus far the best I've come up with is to output both A and B as text files and then go to work on it with an external program.
variance = sum over (x,y) { [red(A(x,y))-red(B(x,y))]^2+[green(A(x,y))-green(B(x,y))]^2+[blue(A(x,y))-green(B(x,y))]^2 }/(x*y)
I think there must be a reasonably quick way to do this but thus far the best I've come up with is to output both A and B as text files and then go to work on it with an external program.