Python实现在图片中加入遮挡
发布时间
阅读量:
阅读量
# 图片中加入遮挡
def make_shelter_picture(photo_path,shelter_path,global_y0,global_x0,height=44,width=44): # 输入原图、遮挡图片路径,输出遮挡处理后的图片
global_x0 = random.randint(15,72) # 遮挡图片左上角定点坐标随机生成
global_y0 = random.randint(15,72)
src_photo = cv2.imread(photo_path)
main_photo_src = cv2.imread(photo_path) # 原图
main_photo = src_photo # 待操作的图
src_height = src_photo.shape[0] #将tuple中的元素取出,赋值给height,width,channels
src_width = src_photo.shape[1]
src_channels = src_photo.shape[2]
shelter_photo = cv2.imread(shelter_path) # 遮挡物
# height = 44 # 调整后遮挡
全部评论 (0)
还没有任何评论哟~
