AttributeError: 模块 'cv2.cv2' 没有属性 'waitkey'

Ahm*_*mam 0 python opencv computer-vision

import cv2

image = cv2.imread('test_image.jpg')

cv2.imshow('result',image)

cv2.waitkey(0)
Run Code Online (Sandbox Code Playgroud)

- 错误

Traceback (most recent call last):

  File "C:\Users\Ahmed Sabry\Desktop\finding-lanes\lanes.py", line 5, in <module>

    cv2.waitkey(0)

AttributeError: module 'cv2.cv2' has no attribute 'waitkey'
Run Code Online (Sandbox Code Playgroud)

小智 7

您在 waitkey 中使用了 'k' ,它是小写的,它应该是大写的

cv2.waitKey(0)
Run Code Online (Sandbox Code Playgroud)