Answer the question
In order to leave comments, you need to log in
How to fix the error error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' when trying to capture a video stream?
To capture the video stream, I use the simplest code:
import cv2
import time
import numpy as np
cap = cv2.VideoCapture(0)
time.sleep(3)
while cv2.waitKey(1)!= 32:
flag, frame = cap.read()
cv2.imshow("video", frame)
cap.release()
cv2.destroyAllWindows()
Error: cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\highgui\src\ window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question