From afc0658188b144a827068ec12c00d7e4cfe34b9e Mon Sep 17 00:00:00 2001 From: Zpadger <31385823+Zpadger@users.noreply.github.com> Date: Sun, 8 Dec 2019 18:18:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80=E4=B8=AAbu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traceback (most recent call last): File "/home/zpj/PycharmProjects/ObjectDetection/Question_100/Q28_Afine1.py", line 44, in out = affine(img, a=1, b=0, c=0, d=1, tx=30, ty=-30) File "/home/zpj/PycharmProjects/ObjectDetection/Question_100/Q28_Afine1.py", line 12, in affine img[1:H+1, 1:W+1] = _img NameError: name '_img' is not defined --- Question_21_30/answers_py/answer_28.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Question_21_30/answers_py/answer_28.py b/Question_21_30/answers_py/answer_28.py index 5106e425..25057e49 100644 --- a/Question_21_30/answers_py/answer_28.py +++ b/Question_21_30/answers_py/answer_28.py @@ -38,10 +38,10 @@ def affine(img, a, b, c, d, tx, ty): # Read image -img = cv2.imread("imori.jpg").astype(np.float32) +_img = cv2.imread("imori.jpg").astype(np.float32) # Affine -out = affine(img, a=1, b=0, c=0, d=1, tx=30, ty=-30) +out = affine(_img, a=1, b=0, c=0, d=1, tx=30, ty=-30) # Save result cv2.imshow("result", out)