error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-h4wtvo23\opencv\modules\core\src\arithm.cpp:725: error: (-215:Assertion failed) (mtype == CV_8UC1 || mtype == CV_8SC1) && _mask.sameSize(*psrc1) in function ‘cv::arithm_op’
masked = cv2.add(img,np.zeros(np.shape(img),dtype=np.uint8), mask=mask)
cv2.imwrite("./mask3.png", masked)
排除了中文路径等常见error后,发现:
我报错的原因是:img 与 mask的size不一致!!!