From fd5134ebed8d3047e874bf67f288663a34cff93b Mon Sep 17 00:00:00 2001 From: Zpadger <31385823+Zpadger@users.noreply.github.com> Date: Thu, 5 Dec 2019 11:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E4=B8=80=E5=A4=84bu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit H, W, C = img.shape ValueError: not enough values to unpack (expected 3, got 2) --- Question_11_20/answers_py/answer_19.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Question_11_20/answers_py/answer_19.py b/Question_11_20/answers_py/answer_19.py index 262f0d9b..f1cc1346 100644 --- a/Question_11_20/answers_py/answer_19.py +++ b/Question_11_20/answers_py/answer_19.py @@ -17,7 +17,11 @@ def BGR2GRAY(img): # LoG filter def LoG_filter(img, K_size=5, sigma=3): - H, W, C = img.shape + if len(img.shape) == 3: + H, W, C =img.shape + else: + img = np.expand_dims(img,axis = -1) + H, W, C =img.shape # zero padding pad = K_size // 2