I am doing a tutorial in opencv about VideoCapture(), I use a usb camera and it works fine, here is the code, I also use jupyter notebook for this.
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
while True:
ret,frame = cap.read()
if ret:
cv2.imshow("frame",frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
cap.release()
cv2.destroyAllWindows()
the success variable comes out as "False" and frame is 'none' and on the VideoCapture(0), I changed the numbers to 1, to 2 to 0.