Skip to content

Instantly share code, notes, and snippets.

@wiccy46
Created July 17, 2019 13:56
Show Gist options
  • Save wiccy46/528a6db17d454dc8d770825c6ab7b80c to your computer and use it in GitHub Desktop.
Save wiccy46/528a6db17d454dc8d770825c6ab7b80c to your computer and use it in GitHub Desktop.
[MSE]Mean square error #python
def mse(imageA, imageB):
# the 'Mean Squared Error' between the two images is the
# sum of the squared difference between the two images;
# NOTE: the two images must have the same dimension
err = np.sum((imageA - imageB) ** 2)
err /= float(imageA.shape[0] * imageA.shape[1])
# return the MSE, the lower the error, the more "similar"
# the two images are
return err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment