"报错"\n---------------------------------------------------------------------------\nerror Traceback (most recent call last)\nCell In[38], line 29\n 26 masked_renwu = cv2.bitwise_and(img_renwu, img_renwu, mask=mask)\n 28 # 融合人物图片和背景图片\n---> 29 final_image = cv2.add(roi, masked_renwu)\n 30 img_beijin[start_y:start_y+height_renwu, start_x:start_x+width_renwu] = final_image\n 32 # 在一个窗口中显示图片\n\nerror: OpenCV(4.8.0) D:\a\opencv-python\opencv-python\opencv\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'\n\n这个错误是由于图像的尺寸不匹配导致的。在代码中,roi和masked_renwu图像的尺寸应该是相同的,但是它们的尺寸不一致,所以报错。\n\n你可以通过调整代码来确保这两个图像的尺寸相同,或者使用相同尺寸的图像进行融合操作。


原文地址: https://www.cveoy.top/t/topic/ppjK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录