Home > other >  Help: open the camera in python
Help: open the camera in python

Time:05-07

Run the code under Anaconda3, don't start to connect the computer USB camera, specific code is as follows:
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
  • Related