# encoding: utf-8
import cv2
def blend_images(base_image_path, overlay_image_path, output_path, overlay_x, overlay_y, overlay_width, overlay_height):
# 读取基础图片和覆盖图片
base_image = cv2.imread(base_image_path)
overlay_image = cv2.imread(overlay_image_path)
# 计算新的高度,保持宽高比
height, width = base_image.shape[:2]
print(height, width)
height = 1895
width = 2490
#165.1 ,92.9
# 检查图片是否成功读取
if base_image is None or overlay_image is None:
print("Error: Unable to load images.")
return
# 调整覆盖图片的尺寸
overlay_resized = cv2.resize(overlay_image, (overlay_width, overlay_height))
# 调整覆盖图片的尺寸
base_image_resized = cv2.resize(base_image, (width, height))
# 在基
图片覆盖1
于 2024-09-19 16:14:03 首次发布