def apply_tags(image, tags): h, w = image.shape[:2] if 'L' in tags: image = get_L(image) elif 'R' in tags: image = get_R(image) elif 'RL' in tags: image = swap_LR(image) elif 'redcyan' in tags: image = redcyan(rgb2gray(image), correct_y=True) elif 'anaglyph' in tags: image = anaglyph(image, correct_y=True) return image
def apply_tags(image, tags): h,w = image.shape[:2] if 'L' in tags: image = get_L(image) elif 'R' in tags: image = get_R(image) elif 'RL' in tags: image = swap_LR(image) elif 'redcyan' in tags: image = redcyan(rgb2gray(image),correct_y=True) elif 'anaglyph' in tags: image = anaglyph(image,correct_y=True) return image
def get_img(hit): if hit is None: raise Exception('Not found') img = imread(hit.value) try: if hit.product == 'redcyan': return redcyan(rgb2gray(img),None,True) if hit.variant is None: hit.variant = hit.default_variant if hit.variant == 'L': return get_L(img) elif hit.variant == 'R': return get_R(img) except AttributeError: pass return img