Movie_Data_Capture/ImageProcessing/hog.py

18 lines
548 B
Python
Raw Normal View History

2023-12-21 10:26:12 +00:00
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