【发布时间】:2019-09-08 02:59:16
【问题描述】:
我正在尝试用 opencv 制作一个小程序。基本上它应该向用户显示一张图片,然后关闭它(或者最好让它打开,但这是另一个问题,因为我现在不知道如何执行代码,同时让图片打开)然后询问用户,他在做什么刚看到。为此,我使用 imshow 和 waitKey。一切正常,但按下键后图片不会关闭。它卡住了。我认为是因为在该命令之后是另一个要执行的代码?
我认为是因为在该命令之后是另一个要执行的代码?
导入 cv2
oriimg = cv2.imread('path')
img = cv2.resize(oriimg,(360,480))
solutionimg = "Answer"
cv2.imshow('Test', img)
cv2.waitKey(0)
input("What can you see here?")
if input==solutionimg:
cv2.destroyAllWindows()
print("Right!")
else:
cv2.destroyAllWindows()
print("Wrong")
【问题讨论】: