1 | initial version |
it means, your image is empty, it never read something from your webcam.
video_capture = cv2.VideoCapture(0)
# please CHECK, if it worked !
if not video_capture.isOpened(): raise Exception("camera could not be opened !")
while True:
ret, frame = video_capture.read()
# CHECK again !
if not ret:
print("no image !")
break
2 | No.2 Revision |
it means, your image is empty, it never read something from your webcam.
video_capture = cv2.VideoCapture(0)
# please CHECK, if it worked !
if not video_capture.isOpened(): raise Exception("camera could not be opened !")
while True:
ret, frame = video_capture.read()
# CHECK again !
if not ret: # if this was a video *file, it means, that the movie's over.
print("no image !")
break