代码拉取完成,页面将自动刷新
## Bulk image resizer
# This script simply resizes all the images in a folder to one-eigth their
# original size. It's useful for shrinking large cell phone pictures down
# to a size that's more manageable for model training.
# Usage: place this script in a folder of images you want to shrink,
# and then run it.
import numpy as np
import cv2
import os
dir_path = os.getcwd()
for filename in os.listdir(dir_path):
# If the images are not .JPG images, change the line below to match the image type.
if filename.endswith(".JPG"):
image = cv2.imread(filename)
resized = cv2.resize(image,None,fx=0.25, fy=0.25, interpolation=cv2.INTER_AREA)
cv2.imwrite(filename,resized)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。