Пример #1
0
    def add_face(self, image_path):
        faces = Faces()
        faces.from_file(image_path)
        image = Image.open(image_path)

        if not faces.data:
            raise MissingFaceException("image has no faces")
        
        face = self.find_key_face(faces, image)

        if not face:
            raise NoRectangleException("can't find valid rectangle for faces in image " + image_path)

        self.faces.append({"face": face, "image": image})