March 2020
Intermediate to advanced
366 pages
9h 8m
English
Transforming the face is a standard process that can be achieved by warping the image using cv2.warpAffine (recall Chapter 3, Finding Objects via Feature Matching and Perspective Transforms). We will follow the next steps to achieve this transformation:
eye_angle_deg = 180 / np.pi * np.arctan2(right_eye[1] - left_eye[1], right_eye[0] - left_eye[0])
eye_dist = np.linalg.norm(left_eye - right_eye) eye_size_scale = (1.0 - desired_eye_x * 2) * desired_img_width / ...