Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #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
Пример #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
Пример #6
0
def create_image(path):
    return Image.create_from_buffer(read_fixture(path))
Пример #7
0
def create_image(path):
    return Image.create_from_buffer(read_fixture(path))
Пример #8
0
 def topic(self):
     return Image.create_from_buffer(read_fixture('broken.jpg'))
Пример #9
0
 def topic(self):
     return Image.create_from_buffer(read_fixture('why_not_a.psd'))