mirror of
https://ghproxy.com/https://github.com/yoshiko2/Movie_Data_Capture.git
synced 2024-09-20 10:35:39 +00:00
18 lines
548 B
Python
18 lines
548 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)) + '] By model hog')
|
|
maxRight = 0
|
|
maxTop = 0
|
|
for face_location in face_locations:
|
|
top, right, bottom, left = face_location
|
|
# 中心点
|
|
x = int((right+left)/2)
|
|
if x > maxRight:
|
|
maxRight = x
|
|
maxTop = top
|
|
return maxRight,maxTop
|