opencv图片混合:cv2.error: OpenCV(3.4.4) /Users/travis/build/skvark/opencv-python/opencv/modules/core/src

# 图像的混合
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'

产生错误原因: 图像叠加,图像混合,要求混合图像必须大小,类型相同。所以报错原因两章图片的大小,类型可能不同。

发布了77 篇原创文章 · 获赞 3 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_24137739/article/details/85114075