MCPcopy Create free account
hub / github.com/PyImageSearch/imutils / shape_to_np

Function shape_to_np

imutils/face_utils/helpers.py:44–54  ·  view source on GitHub ↗
(shape, dtype="int")

Source from the content-addressed store, hash-verified

42 return (x, y, w, h)
43
44def shape_to_np(shape, dtype="int"):
45 # initialize the list of (x, y)-coordinates
46 coords = np.zeros((shape.num_parts, 2), dtype=dtype)
47
48 # loop over all facial landmarks and convert them
49 # to a 2-tuple of (x, y)-coordinates
50 for i in range(0, shape.num_parts):
51 coords[i] = (shape.part(i).x, shape.part(i).y)
52
53 # return the list of (x, y)-coordinates
54 return coords
55
56def visualize_facial_landmarks(image, shape, colors=None, alpha=0.75):
57 # create two copies of the input image -- one for the

Callers 1

alignMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…