      def save_image(output_folder, filename, image):
          """ Save an image """
          output_file = os.path.join(output_folder, filename)
          logger.trace("Saving image: '%s'", output_file)
          cv2.imwrite(output_file, image)  # pylint: disable=no-member
  
  
  class Faces(MediaLoader):
      """ Object to hold the faces that are to be swapped out """
 
</s> remove                     frames_dir + align_eyes +
 </s> add                     frames_dir + </s> remove         self.align_face(faces, align_eyes, size, filename)
 </s> add         self.align_face(faces, size, filename) </s> remove 
    if should_align_eyes is False:
        return mat_umeyama

    mat_umeyama = mat_umeyama * size

    # Convert to matrix
    landmarks = np.matrix(face.landmarks_xy)

    # cv2 expects points to be in the form
    # np.array([ [[x1, y1]], [[x2, y2]], ... ]), we'll expand the dim
    landmarks = np.expand_dims(landmarks, axis=1)

    # Align the landmarks using umeyama
    umeyama_landmarks = cv2.transform(  # pylint: disable=no-member
        landmarks,
        mat_umeyama,
        landmarks.shape)

    # Determine a rotation matrix to align eyes horizontally
    mat_align_eyes = func_align_eyes(umeyama_landmarks, size)

    # Extend the 2x3 transform matrices to 3x3 so we can multiply them
    # and combine them as one
    mat_umeyama = np.matrix(mat_umeyama)
    mat_umeyama.resize((3, 3))
    mat_align_eyes = np.matrix(mat_align_eyes)
    mat_align_eyes.resize((3, 3))
    mat_umeyama[2] = mat_align_eyes[2] = [0, 0, 1]

    # Combine the umeyama transform with the extra rotation matrix
    transform_mat = mat_align_eyes * mat_umeyama

    # Remove the extra row added, shape needs to be 2x3
    transform_mat = np.delete(transform_mat, 2, 0)
    transform_mat = transform_mat / size
    logger.trace("Returning: %s", transform_mat)
    return transform_mat
 </s> add     return mat_umeyama
 </s> remove from lib.align_eyes import FACIAL_LANDMARKS_IDXS

 </s> add  </s> remove         self.image = np.zeros((height, width, 3), np.uint8)
 </s> add         self.image = np.zeros((height, width, 3), dtype="uint8")
        output_file = os.path.splitext(output_file)[0]+'.png'
      def save_image(output_folder, filename, image):
          """ Save an image """
          output_file = os.path.join(output_folder, filename)
        output_file = os.path.splitext(output_file)[0]+'.png'
          logger.trace("Saving image: '%s'", output_file)
          cv2.imwrite(output_file, image)  # pylint: disable=no-member
  
  
  class Faces(MediaLoader):
      """ Object to hold the faces that are to be swapped out """
keep keep add keep keep keep keep keep keep
 Align eyes deprecation (#851)

* align eyes removal

* add align_eyes tool 
tools/lib_alignments/media.py