【发布时间】:2021-03-22 17:31:27
【问题描述】:
我正在使用face_recognition的python库进行人脸识别演示。
# Grab a single frame of video
ret, frame = video_capture.read()
# Resize frame of video to 1/4 size for faster face recognition processing
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
# Convert the image from BGR color (which OpenCV uses) to RGB color (which face_recognition uses)
rgb_small_frame = small_frame[:, :, ::-1]
# Only process every other frame of video to save time
# Find all the faces and face encodings in the current frame of video
face_locations = face_recognition.face_locations(rgb_small_frame)
上面的代码,据我所知,检测给定框架中不同大小的人脸。如果我想绘制一个边界框,并且如果该边界框上有一个人脸,那么只有那个人脸应该用于进一步处理。我的 CPU 不会检测整个帧中不同大小的人脸,而只能从具有固定大小的感兴趣区域检测人脸。
【问题讨论】:
标签: python face-detection face-recognition