Ho Yeung Lee wrote: > 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)
These are probably images represented as numpy arrays. To calculate the pixelwise difference both images have to have the same size whereas one of your samples seems to be 7x29xRGB, and the other 7x37xRGB. -- https://mail.python.org/mailman/listinfo/python-list