def save_face_with_hash(filename, extension, face): """ Save a face and return it's hash """ f_hash, img = hash_encode_image(face, extension) logger.trace("Saving face: '%s'", filename) with open(filename, "wb") as out_file: out_file.write(img) return f_hash
def save_face_with_hash(filename, extension, face): """ Save a face and return it's hash """ f_hash, img = hash_encode_image(face, extension) logger.trace("Saving face: '%s'", filename) with open(filename, "wb") as out_file: out_file.write(img) return f_hash
def output_faces(self, filename, faces, save_queue): """ Output faces to save thread """ final_faces = list() for idx, detected_face in enumerate(faces["detected_faces"]): output_file = detected_face["file_location"] extension = Path(filename).suffix out_filename = "{}_{}{}".format(str(output_file), str(idx), extension) face = detected_face["face"] resized_face = face.aligned_face face.hash, img = hash_encode_image(resized_face, extension) save_queue.put((out_filename, img)) final_faces.append(face.to_alignment()) self.alignments.data[os.path.basename(filename)] = final_faces
def output_faces(self, filename, faces): """ Output faces to save thread """ final_faces = list() for idx, detected_face in enumerate(faces["detected_faces"]): output_file = detected_face["file_location"] extension = Path(filename).suffix out_filename = "{}_{}{}".format(str(output_file), str(idx), extension) face = detected_face["face"] resized_face = face.aligned_face face.hash, img = hash_encode_image(resized_face, extension) self.save_queue.put((out_filename, img)) final_faces.append(face.to_alignment()) self.alignments.data[os.path.basename(filename)] = final_faces