import cv2
import numpy as np
img1 = cv2.imread('3D-Matplotlib.png')
img2 = cv2.imread('mainsvmimage.png')
# add = img1 + img2
# add = cv2.add(img1, img2) # added all pixel values together
# (155, 211, 79) + 50, 170, 200 = 205, 381, 279
# which becomes (205, 255, 255) since 255 is the max
# add = cv2.add(img1//2, img2//2)
print(img1.shape)
print(img2.shape)
weighted = cv2.addWeighted(
src1=np.array(img1),
alpha=0.6,
src2=np.array(img2),
beta=0.4,
gamma=0)
cv2.imshow('image', weighted)
cv2.waitKey(0)
cv2.destroyAllWindows()
以上是我根据本教程使用的代码:https://pythonprogramming.net/image-arithmetics-logic-python-opencv-tutorial/
当我尝试在IDE中运行时出现以下错误:
TypeError: 'tuple' object is not callable
我在Spyder 3.2.8版的Windows 10上运行python版本3.6.4。
当我使用相同的代码并通过Windows命令提示符运行它时,它可以工作,但它没有解决我在IDE中遇到的问题。