- import cv2 as cv
- import cv2 as cv
- bg = cv.imread("test_images/background.jpg", cv.IMREAD_COLOR)
- fg = cv.imread("test_images/forground.png", cv.IMREAD_COLOR)
- # 打印图片尺寸
- print(bg.shape)
- print(fg.shape)
- resize_size = (1200, 800)
- bg = cv.resize(bg, resize_size, interpolation=cv.INTER_AREA)
- fg = cv.resize(fg, resize_size, interpolation=cv.INTER_AREA)
- result = cv.addWeighted(src1=bg, alpha=0.5, src2=fg, beta=0.8, gamma=3)
- cv.imwrite("test_images/result.jpg",result)
- cv.imshow("test", result)
- cv.waitKey(0)
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |