使用 OpenCV 混合多个图像

Ama*_*nda 1 python opencv image

使用python将多个图像与OpenCV混合的方法是什么?我遇到了以下代码段:

img = cv2.addWeighted(mountain, 0.3, dog, 0.7, 0) 
Run Code Online (Sandbox Code Playgroud)

https://docs.opencv.org/3.4/d5/dc4/tutorial_adding_images.html

这显示了一种混合 2 个图像mountaindog. 如果我想混合 2 个以上的图像怎么办?我怎么能这样做?

Sha*_*ngh 7

尝试这个:

blendedImage = weight_1 * image_1 + weight_2 * image_2 + ... + weight_n * image_n

  • 确保所有权重之和为 1 (2认同)