@rawlyn: the above code computes the so-called root-mean-square difference for two images (histogram is like a fingerprint for an image). RMS is a measure of how similar two images are. If RMS is zero the images are identical.