from hashlib import new
from importlib.resources import path
from os import listdir, mkdir
import cv2,os,glob
import numpy as np
from tqdm import tqdm
from colorama import Fore
save_path = ""
path1 = ''
path2 = ''
if not os.path.exists((save_path)):
os.mkdir(save_path)
else:
print('文件夹已经存在')
exit()
for i in tqdm(glob.glob(rf'{path1}\\*.jpg'),bar_format ='{l_bar}%s{bar}%s{r_bar}' % (Fore.BLUE,Fore.RESET)):
name = i.split('\\')[-1]
img1 = cv2.imread(i)
img2 = cv2.imread(f'{path2}\\{name}')
cv2.putText(img1,txt,(10,50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
cv2.putText(img2,txt,(10,50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
#横向连接
image = np.hstack([img1,img2])
# image = cv2.resize(image,(2784,1000))
#cv2.imshow("",image)
#cv2.waitKey()
cv2.imwrite(save_path+'\\'f'{name}',image)
python将两张图片拼在一起并加上描述
于 2022-11-17 15:50:41 首次发布

8万+

被折叠的 条评论
为什么被折叠?



