1119625819 发表于 2022-11-17 14:57:52

python函数库cv2问题错误

import cv2

img1 = cv2.imread("test0.jpg")
img2 = cv2.imread("test01.jpg")
add1 = cv2.add(img1,img2)
cv2.namedWindow("Image",cv2.WINDOW_FREERATIO)
cv2.imshow("Image", add1)
cv2.waitKey(-1)
cv2.destroyAllWindows()

返回
D:\Anaconda\envs\python\python.exe D:\python\dd.py
Traceback (most recent call last):
File "D:\python\dd.py", line 7, in <module>
    add1 = cv2.add(img1,img2)
cv2.error: OpenCV(4.6.0) C:\b\abs_74oeeuevib\croots\recipe\opencv-suite_1664548340488\work\modules\core\src\arithm.cpp:650: 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 'cv::arithm_op'

hrpzcf 发表于 2022-11-17 15:26:39

两个图片大小和通道数要相同
页: [1]
查看完整版本: python函数库cv2问题错误