Created
July 17, 2019 13:56
-
-
Save wiccy46/528a6db17d454dc8d770825c6ab7b80c to your computer and use it in GitHub Desktop.
[MSE]Mean square error #python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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