26 lines
576 B
Python
26 lines
576 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
# @Time : 2022-7-26 0026 17:44
|
||
|
# @Author : Qing
|
||
|
# @Email : derighoid@gmail.com
|
||
|
# @File : Image_Mix.py
|
||
|
# @Software: PyCharm
|
||
|
|
||
|
from PIL import Image
|
||
|
import matplotlib.pyplot as plt
|
||
|
import numpy as np
|
||
|
import cv2
|
||
|
# 阿尔法图像混合
|
||
|
def imageMix(imagePath1, imagePath2):
|
||
|
img1 = Image.open(imagePath1)
|
||
|
im1 = np.array(img1)
|
||
|
img2 = Image.open(imagePath2)
|
||
|
im2 = np.array(img2)
|
||
|
|
||
|
img3 = cv2.addWeighted(im1, 0.8, im2, 0.3, 0)
|
||
|
|
||
|
plt.imshow(img3)
|
||
|
Image.fromarray(np.uint8(img3)).save("./data/picture14.png")
|
||
|
plt.show()
|
||
|
|
||
|
|