import cv2
import time
cap = cv2.VideoCapture(cv2.CAP_DSHOW)# camera ID + cv2.CAP_DSHOW обязательно
time.sleep(2)
cap.set(cv2.CAP_PROP_SETTINGS, 1);
while True:
flag, img = cap.read()
cv2.imshow('cam',img)
ch = cv2.waitKey(5)
if ch == 27:
break
cap.release()
cv2.destroyAllWindows()