pythonopencv

Module 'cv2' has no 'VideoCapture' member


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()

This my code andi get this error 1.Module 'cv2' has no 'VideoCapture' member 2.Module 'cv2' has no 'imshow' member 3.Module 'cv2' has no 'waitKey' member 4.Module 'cv2' has no 'destroyAllWindows' member

enter image description here


Solution

  • If you use VSCode, you can try using this code:

    from cv2 import cv2