gpt4 book ai didi

python - 模块 'cv2' 没有 'VideoCapture' 成员

转载 作者:行者123 更新时间:2023-12-02 16:14:35 26 4
gpt4 key购买 nike

import numpy
import cv2

cap = cv2.VideoCapture(0)

while(True):
ret, frame = cap.read()

cv2.imshow('frame',frame)
if cv2.waitKey(20) & 0xFF == ord('q'):
break


cap.release()
cv2.destroyAllWindows()

这是我的代码,我得到了这个错误
1.Module 'cv2' 没有'VideoCapture' 成员
2.模块'cv2'没有'imshow'成员
3.Module 'cv2' 没有'waitKey' 成员
4.Module 'cv2' 没有'destroyAllWindows' 成员

enter image description here

最佳答案

如果您使用 VSCode,您可以尝试使用以下代码:

from cv2 import cv2

关于python - 模块 'cv2' 没有 'VideoCapture' 成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61817354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com