python - 无法将调整大小的图像保存在 cv2 的特定文件夹中
问题描述
我正在尝试在 python 中编写代码以从特定文件夹批量调整图像大小并将输出保存到不同的指定文件夹。我无法将图像保存在提到的文件夹名称为“Resized”的 outPath 中。任何人都可以帮我解决这个问题...
import os
import cv2, glob
imgPath = "E:/Data/Ori"
outPath = "E:/Data/Resized"
images = glob.glob(imgPath + "/" + "*.jpg")
for image in images:
img = cv2.imread(image,1) #1 for color scale
res = cv2.resize(img, (400,300)) #width = 400, height = 300
cv2.imwrite(outPath + '/' + image, res) #Unable to save the images in 'Resized' folder
解决方案
推荐阅读
- r - Matlab中错误的树状图(与R相比)
- python-3.x - 即使在全新安装后也没有名为 pandas datareader 的模块
- powershell - 通过 CMD 重命名多个 pdf 文件
- javascript - 使用 jquery 加载失败后如何重新加载图像?
- typo3 - TYPO3:“access_group”字段是做什么用的?
- python - Python,如何避免对低于当前级别的日志记录语句进行参数评估
- javascript - 有没有办法使用 Puppeteer 在 React Dropzone 中上传文件?
- laravel - 表关系以及如何在 laravel 控制器中使用它
- android - 是否可以以 60 fps 播放 arcore?
- javascript - AngularJS - 如何用 2 个参数构造端点的 url