OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (wher

OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels)


自己模拟了错误:

import numpy as np
import cv2
preFrame=np.asanyarray([1,2,3])
frame2=np.asanyarray([1,2])
diff = cv2.subtract(preFrame, frame2)
if not np.any(diff):  # 判断为图片相同
    print(True)
原因: preFrame和 frame2的shage不一样

你可能感兴趣的:(opencv)