def tile_ims(filename, directory):
"""Load all images in the given directory and tile them into one."""
ims = [mpimg.imread(os.path.join(directory, f)) for f in sorted(os.listdir(directory))]
ims = np.array(ims)
ims = ims.transpose((0, 3, 1, 2)) # (n, h, w, c) -> (n, c, h ,w)
save_ims(filename, ims)
评论列表
文章目录