import os
import cv2
import glob
import copy
import numpy as np
prefix = 're00'
imagename = 'restored.jpg'
rootdir = './ourModelResult'
savedir = './restored'
for i in range(32):
dirprefix = ''.join([prefix, f'{i:02d}-*'])
readpath = os.path.join(rootdir, dirprefix)
dirlist = glob.glob(readpath)
j = 0
step = 8
blockimage = None
fullimage = None
for dir in dirlist:
imagepath = os.path.join(dir, imagename)
print(imagepath)
image = cv2.imread(imagepath)
if blockimage is None:
blockimage = image
else:
blockimage = np.concatenate([blockimage, image], axis=1)
j = j + 1
if j % step == 0:
if fullimage is None:
fullimage = copy.deepcopy(blockimage)
print(fullimage.shape)
else:
fullimage = np.concatenate([fullimage,blockimage], axis=0)
print(fullimage.shape)
blockimage = None
savepath = os.path.join(savedir, str(i+1)+'.jpg')
cv2.imwrite(savepath, fullimage)
python 图片合成 python多图合并成一张图
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Linux Debian12使用flameshot或gnome-screenshot和ImageMagick垂直合并多张图片后组成一张滚动长图
在发布博客,有时需要滚动截长图,虽然在windows系统有滚动截长图的工具,例如:FastStone Capture等,但是Linux Debian系统,这种滚动截长图的工具没有找到合适的。经过自己筛选验证,发现Linux Debian12使用flameshot或gnome-screenshot截取多张图片,再使用和ImageMagick图像处理工具进行垂直合并多张图片,这样就可以组合成一张滚动长
图像处理 linux debian flameshot ImageMagick -
一张图详解开源监控夜莺(Nightingale)的架构
使用一张非常详尽的架构图,解释开源夜莺监控项目的原理和数据流
开源监控 夜莺监控 开源夜莺 Nightingale Prometheus -
轻松复现一张AI图片
现在有一个非常漂亮的AI图片,你是不是想知道他是怎么生成的?今天我会交给大家三种方法,学会了,什么图都可以手到擒来了。
AIGC stable diffusion 程序那些事