I got ValueError: operands could not be broadcast together with shapes (194,259,3) (600,800,3)
with the below code:
import numpy
import math
import cv2
original = cv2.imread("original.png")
contrast = cv2.imread("compressed.png",1)
def psnr(img1, img2):
mse = numpy.mean( (img1 - img2) ** 2 )
if mse == 0:
return 100
PIXEL_MAX = 255.0
return 20 * math.log10(PIXEL_MAX / math.sqrt(mse))
d=psnr(original,contrast)
print(d)
What was the problem with the implementation?