如何使用Jupyter笔记本保存输出图像?

2024-10-03 23:28:05 发布

您现在位置:Python中文网/ 问答频道 /正文

出于教育目的,我正在尝试从该存储库运行以下代码

https://github.com/UjjwalSaxena/Automold--Road-Augmentation-Library

我正在使用Jupiter笔记本绘制运行以下代码的输出:

bright_images= am.brighten(images[0:6]) 
hp.visualize(bright_images)

我得到了下面的图,它将图像绘制成列

我想单独保存这些输出图像,而不是附加在一起。 我的问题是如何分别保存这些图像,每个图像以其原始大小保存在文件夹中


Tags: 代码https图像目的githubcomlibrary绘制
1条回答
网友
1楼 · 发布于 2024-10-03 23:28:05

从文件中:

The visualize function helps in displaying images easily without requiring you to write the whole code.

如果深入研究源代码,库将使用cv2akaopenCV作为图像

所以你的图像在bright_images中,你可以像这样保存图像

import cv2

i = 0
while i < len(bright_images) - 1:
    cv2.imwrite(f'path_to/image_{i}.png', bright_images[i])
    i += 1

相关问题 更多 >