ValueError: operands could not be broadcast together with shapes

Ho Yeung Lee jobmattcon at gmail.com
Sun Aug 6 10:18:13 EDT 2017


def mse(imageA, imageB):
    err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2)
    err /= float(imageA.shape[0] * imageA.shape[1])
    return err

original = cv2.imread("C:\\Users\\hello\\Documents\\words\\" + xx)
later = cv2.imread("C:\\Users\\hello\\Documents\\words\\"+ yy)
mserr = mse(original, later)

Traceback (most recent call last):
  File "words29.py", line 135, in <module>
    mserr = mse(original, later)
  File "words29.py", line 27, in mse
    err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2)
ValueError: operands could not be broadcast together with shapes (7,29,3) (7,37,3)



More information about the Python-list mailing list