MCPcopy
hub / github.com/ageitgey/face_recognition / face_landmarks

Function face_landmarks

face_recognition/api.py:165–187  ·  view source on GitHub ↗

Given an image, returns a dict of face feature locations (eyes, nose, etc) for each face in the image :param face_image: image to search :param face_locations: Optionally provide a list of face locations to check. :return: A list of dicts of face feature locations (eyes, nose, etc)

(face_image, face_locations=None)

Source from the content-addressed store, hash-verified

163
164
165def face_landmarks(face_image, face_locations=None):
166 """
167 Given an image, returns a dict of face feature locations (eyes, nose, etc) for each face in the image
168
169 :param face_image: image to search
170 :param face_locations: Optionally provide a list of face locations to check.
171 :return: A list of dicts of face feature locations (eyes, nose, etc)
172 """
173 landmarks = _raw_face_landmarks(face_image, face_locations)
174 landmarks_as_tuples = [[(p.x, p.y) for p in landmark.parts()] for landmark in landmarks]
175
176 # For a definition of each point index, see https://cdn-images-1.medium.com/max/1600/1*AbEg31EgkbXSQehuNJBlWg.png
177 return [{
178 "chin": points[0:17],
179 "left_eyebrow": points[17:22],
180 "right_eyebrow": points[22:27],
181 "nose_bridge": points[27:31],
182 "nose_tip": points[31:36],
183 "left_eye": points[36:42],
184 "right_eye": points[42:48],
185 "top_lip": points[48:55] + [points[64]] + [points[63]] + [points[62]] + [points[61]] + [points[60]],
186 "bottom_lip": points[54:60] + [points[48]] + [points[60]] + [points[67]] + [points[66]] + [points[65]] + [points[64]]
187 } for points in landmarks_as_tuples]
188
189
190def face_encodings(face_image, known_face_locations=None, num_jitters=1):

Callers

nothing calls this directly

Calls 1

_raw_face_landmarksFunction · 0.85

Tested by

no test coverage detected