def calculate_rms(expectedImage, actualImage):
 if (expectedImage.shape != actualImage.shape):
  raise ImageComparisonFailure(u'image sizes do not match expected size: {0} actual size {1}'.format(expectedImage.shape, actualImage.shape))
 num_values = expectedImage.size
 abs_diff_image = abs((expectedImage - actualImage))
 histogram = np.bincount(abs_diff_image.ravel(), minlength=256)
 sum_of_squares = np.sum((histogram * (np.arange(len(histogram)) ** 2)))
 rms = np.sqrt((float(sum_of_squares) / num_values))
 return rms

def calculate_rms ( expectedImage , actualImage ) : if ( expectedImage . shape != actualImage . shape ) : raise ImageComparisonFailure ( u'image sizes do not match expected size: {0} actual size {1}' . format ( expectedImage . shape , actualImage . shape ) ) num_values = expectedImage . size abs_diff_image = abs ( ( expectedImage - actualImage ) ) histogram = np . bincount ( abs_diff_image . ravel ( ) , minlength = 256 ) sum_of_squares = np . sum ( ( histogram * ( np . arange ( len ( histogram ) ) ** 2 ) ) ) rms = np . sqrt ( ( float ( sum_of_squares ) / num_values ) ) return rms
calculate the per-pixel errors .