The import cv2
Cap=cv2. VideoCapture (0)
If cap. IsOpened () :
Ret, frame=cap. The read ()
Cv2. Imshow (' frame, frame)
Cv2. WaitKey (3000)
Cap. Release ()
Cv2. DestroyAllWindows ()
Running tips:
Error: the OpenCV (4.5.1) C: \ Users \ appveyor \ AppData \ Local \ Temp \ \ 1 PIP - the req - build - oduouqig \ OpenCV \ modules \ highgui \ SRC \ Windows CPP: 376: error: (- 215: an Assertion failed) size. Width> 0 & amp; & Size. Height> 0 in function 'CV: : imshow'
CodePudding user response:
This code, you can open, but open the time limit