From 82f2495ba792819755382829149365363b4f5182 Mon Sep 17 00:00:00 2001 From: Dominik Breksa Date: Mon, 8 Dec 2025 17:36:05 +0100 Subject: [PATCH] fix: fixed grayscale commadn' --- src/python/app/command/parser.py | 2 -- src/python/app/operation/grayscale.py | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/app/command/parser.py b/src/python/app/command/parser.py index d4abc8e..48fe02e 100644 --- a/src/python/app/command/parser.py +++ b/src/python/app/command/parser.py @@ -12,8 +12,6 @@ from app.operation.roll import RollOperation from app.operation.rotate90 import Rotate90Operation -from app.operation.scale import ScaleOperation -from app.operation.translate import TranslateOperation def get_parser() -> ArgumentParser: diff --git a/src/python/app/operation/grayscale.py b/src/python/app/operation/grayscale.py index 0163aee..512d5be 100644 --- a/src/python/app/operation/grayscale.py +++ b/src/python/app/operation/grayscale.py @@ -23,10 +23,12 @@ def parser(cls, parser: ArgumentParser) -> None: pass def __call__(self, args: Namespace, input_image: Image) -> Image: - return Image(np.expand_dims(np.clip( + return Image(np.repeat(np.expand_dims(np.clip( 0.2126 * input_image.data[:, :, 0] + 0.7152 * input_image.data[:, :, 1] + 0.0722 * input_image.data[:, :, 1], a_min=0., a_max=255.).astype(np.uint8), + axis=-1), + repeats=3, axis=-1))