diff options
-rw-r--r-- | src/argaze/__main__.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/argaze/__main__.py b/src/argaze/__main__.py index 80f12a3..925adf0 100644 --- a/src/argaze/__main__.py +++ b/src/argaze/__main__.py @@ -36,7 +36,7 @@ parser = argparse.ArgumentParser(description=__doc__.split('-')[0]) parser.add_argument('context_file', metavar='CONTEXT_FILE', type=str, help='JSON context filepath') parser.add_argument('-v', '--verbose', action='store_true', default=False, help='enable verbose mode to print information in console') parser.add_argument('-p', '--pipe_path', metavar='PIPE_PATH', type=str, default=None, help='enable pipe communication to execute external commands') -parser.add_argument('-x', '--display', metavar='DISPLAY', nargs="+", type=int, default=[1920, 1080], help='adapt windows to display dimension') +parser.add_argument('-x', '--display', metavar='DISPLAY', nargs="+", type=int, default=None, help='adapt windows to display dimension') parser.add_argument('--no-window', action='store_true', default=False, help='disable window mode') args = parser.parse_args() @@ -60,13 +60,19 @@ if args.pipe_path is not None: def display(name, image, factor): """Adapt image to display dimension.""" - display_size = tuple(args.display) - height, width, _ = image.shape - image_ratio = width/height + if args.display is not None: - new_image_size = (int(display_size[1] * factor * image_ratio), int(display_size[1] * factor)) + display_size = tuple(args.display) + height, width, _ = image.shape + image_ratio = width/height - cv2.imshow(name, cv2.resize(image, dsize=new_image_size, interpolation=cv2.INTER_LINEAR)) + new_image_size = (int(display_size[1] * factor * image_ratio), int(display_size[1] * factor)) + + cv2.imshow(name, cv2.resize(image, dsize=new_image_size, interpolation=cv2.INTER_LINEAR)) + + else: + + cv2.imshow(name, image) # Load context from JSON file with load(args.context_file) as context: |