赞
踩
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)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。