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): 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
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
def create_image(path): return Image.create_from_buffer(read_fixture(path))
def topic(self): return Image.create_from_buffer(read_fixture('broken.jpg'))
def topic(self): return Image.create_from_buffer(read_fixture('why_not_a.psd'))