python - 如何在python中的文件夹中添加图像
问题描述
如何将图像保存在文件夹中?该文件夹来自另一个用户,该用户想要保存该图像。从用户那里获得的文件夹名称在哪里写?
解决方案
尝试pip install opencv-python
在任何命令行中使用安装 OpenCV。然后,使用下面的代码片段。
import cv2
from os import path
def saveImage(image):
myImage
address = input('Please enter your address here:')
imgSaveDir = path.join(address, 'yourImagesName')
cv2.imwrite(imgSaveDir , image)
使用此功能,您将能够将图像保存在您输入的任何目录中。
推荐阅读
- typescript - 使用@nestjs/mongoose 时如何在文档界面中定义静态猫鼬方法?
- sql-server - 从动态查询 SQL 返回语句
- r - 使用 R 代码在 Proc IML 中迭代地模拟数据,然后在 SAS 程序中进行分析,这是一种更快的方法吗?
- sass - 如何使用 gulp 编译 bootstrap-material-design sass 文件?
- python - Python将单个列表分成多个子列表
- postgresql - 将压缩的 CSV(filename.csv.gz) 文件加载到 PostgreSQL 表中
- scala - 带有 Spark 解释器的 Zeppelin 忽略在类/函数定义之外声明的导入
- named-entity-recognition - IBM Watson NLU 中货币实体到实体提取的低分
- spring - 无法找到 JSP 翻译文件存储在 Google App 引擎中
- hyperledger-fabric - 如何从 Hyperledger Fabric 网络中检索交易以进行审计?