(shape, dtype="int")
| 42 | return (x, y, w, h) |
| 43 | |
| 44 | def 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 | |
| 56 | def visualize_facial_landmarks(image, shape, colors=None, alpha=0.75): |
| 57 | # create two copies of the input image -- one for the |
no outgoing calls
no test coverage detected
searching dependent graphs…