From 607b89a9f356d5144da92c8ad94bc87b76ad9e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E6=B5=B7=E6=98=8E?= <11165008@vivo.com> Date: Mon, 1 Sep 2025 19:18:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E5=83=8F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=AB=98=E6=96=AF=E5=99=AA=E5=A3=B0=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81bug=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image_proc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image_proc.py b/image_proc.py index 7d54ad5..17a1aba 100644 --- a/image_proc.py +++ b/image_proc.py @@ -166,9 +166,9 @@ def gaussianNoisy(im, mean=mean, sigma=sigma): return im img = np.asarray(image) - width, height = img.shape + height, width, channels = img.shape img = gaussianNoisy(img[:].flatten(), mean, sigma) - img = img.reshape([width, height]) + img = img.reshape([height, width, channels]) return Image.fromarray(np.uint8(img)) From e265606d6eedbca2a6b7c8ca950d372d45323e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E6=B5=B7=E6=98=8E?= <11165008@vivo.com> Date: Mon, 1 Sep 2025 19:38:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E5=83=8F?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=A8=A1=E5=9D=97=E9=87=8C=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=AB=98=E6=96=AF=E5=99=AA=E5=A3=B0=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81bug=E5=92=8C=E5=B8=B8=E8=A7=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image_proc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/image_proc.py b/image_proc.py index 17a1aba..29985c6 100644 --- a/image_proc.py +++ b/image_proc.py @@ -166,7 +166,8 @@ def gaussianNoisy(im, mean=mean, sigma=sigma): return im img = np.asarray(image) - height, width, channels = img.shape + height, width = img.shape[:2] + channels = 1 if img.ndim == 2 else img.shape[2] img = gaussianNoisy(img[:].flatten(), mean, sigma) img = img.reshape([height, width, channels]) return Image.fromarray(np.uint8(img))