def preprocess(frame, width, height, x, y, w, h):
"""
Preprocesses an image for Face Recognition
"""
cropped = frame[y: y+h, x: x+w]
grayed = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY)
resized = cv2.resize(grayed, (width, height))
equalized = cv2.equalizeHist(resized)
filtered = cv2.bilateralFilter(equalized, 5, 60, 60)
return filtered
评论列表
文章目录