发布网友 发布时间:2022-04-27 02:44
共1个回答
热心网友 时间:2022-04-18 04:45
# -*- coding: utf-8 -*-
import cv2
import os
import numpy
import cutHumanFace
def saveCutFace(filePath, pathSave = 'cutFace', normalizeWidth = 300, normalizeHeight = 300):
"""
:param filePath: string, 文件夹路径
"""
if not os.path.exists(savePath):
os.makedirs(savePath); #保存的文件夹
files = os.listdir(filePath); #列出目录下的所有文件
normalizeWidth = 100 #以100×100为大小
normalizeHeight = 100
for file in files:
normalizeFace = cv2.resize(cutFace, (normalizeWidth,normalizeHeight), interpolation=cv2.INTER_AREA);
cv2.imwrite(savePath, normalizeFace);