# 图像的混合 img1 = cv2.imread('abc.jpg') img2 = cv2.imread('timg.jpg') dst = cv2.addWeighted(img1, 0.7, img2, 0.3, 0) cv2.imshow('dst', dst) cv2.waitKey(0) cv2.destroyAllWindows()
报出如下错误:cv2.error: OpenCV(3.4.4) /Users/travis/build/skvark/opencv-python/opencv/modules/core/src/arithm.cpp:663: error: (-209: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), nor 'array op scalar', nor 'scalar op array' in function 'arithm_op'
产生错误原因: 图像叠加,图像混合,要求混合图像必须大小,类型相同。所以报错原因两章图片的大小,类型可能不同。