예제 #1
0
    def process_image(self, image):
        """Process an image."""
        try:
            detections = self._api.detect(image)
            self.faces = hound.get_faces(detections)
            self.people = hound.get_people(detections)
            metadata = hound.get_metadata(detections)
            self._image_width = metadata["image_width"]
            self._image_height = metadata["image_height"]

            self._state = len(self.people)
            if self._state > 0:
                self._last_detection = dt_util.now().strftime(DATETIME_FORMAT)
            if hasattr(self, "_save_file_folder") and self._state > 0:
                self.save_image(image, self.people, self.faces,
                                self._save_file_folder)
            for face in self.faces:
                self.fire_face_detected_event(face)
            for person in self.people:
                self.fire_person_detected_event(person)

        except hound.SimplehoundException as exc:
            _LOGGER.error(str(exc))
            self.faces = []
            self.people = []
            self._image_width = None
            self._image_height = None
예제 #2
0
    def process_image(self, image):
        """Process an image."""
        detections = self._api.detect(image)
        people = hound.get_people(detections)
        self._state = len(people)

        metadata = hound.get_metadata(detections)
        self._image_width = metadata["image_width"]
        self._image_height = metadata["image_height"]
        for person in people:
            self.fire_person_detected_event(person)
예제 #3
0
    def process_image(self, image):
        """Process an image."""
        detections = self._api.detect(image)
        people = hound.get_people(detections)
        self._state = len(people)
        if self._state > 0:
            self._last_detection = dt_util.now().strftime(DATETIME_FORMAT)

        metadata = hound.get_metadata(detections)
        self._image_width = metadata["image_width"]
        self._image_height = metadata["image_height"]
        for person in people:
            self.fire_person_detected_event(person)
        if self._save_file_folder and self._state > 0:
            self.save_image(image, people, self._save_file_folder)
    def process_image(self, image):
        """Process an image."""
        self._age = []
        self._gender = []
        detections = self._api.detect(image)
        people = hound.get_people(detections)
        faces = hound.get_faces(detections)
        self._state = len(people)
        if self._state > 0:
            self._last_detection = dt_util.now().strftime(DATETIME_FORMAT)

        metadata = hound.get_metadata(detections)
        self._image_width = metadata["image_width"]
        self._image_height = metadata["image_height"]
        for person in people:
            self.fire_person_detected_event(person)
        if self._save_file_folder:
            if self._state > 0 or self._always_save_latest_jpg:
                self.save_image(image, people, self._save_file_folder)
        for face in faces:
            self._age.append(face["age"])
            self._gender.append(face["gender"])
예제 #5
0
def test_get_people():
    assert hound.get_people(DETECTIONS) == PEOPLE