Files
AV_Data_Capture/ImageProcessing/hog.py
2022-02-04 03:49:27 +08:00

16 lines
456 B
Python

import face_recognition
def face_center(filename, model):
image = face_recognition.load_image_file(filename)
face_locations = face_recognition.face_locations(image, 1, model)
print('[+]Found person ' + str(len(face_locations)))
max = 0
for face_location in face_locations:
top, right, bottom, left = face_location
# 中心点
x = int((right+left)/2)
if x > max:
max = x
return max