def detect(self, detector, image_data):
        detector = self.detectors.get(detector, None)
        if detector is None:
            raise AttributeError('Detector unavailable')

        image = Image.create_from_buffer(image_data)
        if image is None:
            return []

        return detector.detect(image)
    def detect(self, detector, image_data):
        detector = self.detectors[detector]
        if detector is None:
            return None

        image = Image.create_from_buffer(image_data)
        if image is None:
            return []

        image.grayscale()
        return detector.detect(image)
    def detect(self, detector, image_data):
        detector = self.detectors[detector]
        if detector is None:
            return None

        image = Image.create_from_buffer(image_data)
        if image is None:
            return []

        image.grayscale()
        return detector.detect(image)
Exemple #4
0
    def detect(self, detector, image_data):
        result = []
        image = Image.create_from_buffer(image_data)
        if image is None:
            return []

        for detector_key in detector.split("+"):
            try:
                result = result + self.detectors[detector_key].detect(image)
            except KeyError as key_error:
                raise AttributeError("Detector unavailable") from key_error
        return result
Exemple #5
0
    def detect(self, detector, image_data):
        result = []
        image = Image.create_from_buffer(image_data)
        if image is None:
            return []

        for detector_key in detector.split('+'):
            try:
                result = result + self.detectors[detector_key].detect(image)
            except KeyError:
                raise AttributeError('Detector unavailable')
        return result
Exemple #6
0
def create_image(path):
    return Image.create_from_buffer(read_fixture(path))
Exemple #7
0
def create_image(path):
    return Image.create_from_buffer(read_fixture(path))
Exemple #8
0
 def topic(self):
     return Image.create_from_buffer(read_fixture('broken.jpg'))
Exemple #9
0
 def topic(self):
     return Image.create_from_buffer(read_fixture('why_not_a.psd'))