Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to fix error error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' when trying to capture a video stream?

I use the simplest code: image description and I have an error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' How can I fix that? Thanks

How to fix error error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' when trying to capture a video stream?

I use the simplest code: image description import cv2 import time import numpy as np

cv2.namedWindow("video")

cap = cv2.VideoCapture(1) time.sleep(3)

while cv2.waitKey(1)!= 30: flag, frame = cap.read() cv2.imshow("video", frame)

cap.release() cv2.destroyAllWindows() and I have an error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' How can I fix that? Thanks

How to fix error error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' when trying to capture a video stream?

I use the simplest code:

import cv2
import time
import numpy as np

np cv2.namedWindow("video")

cv2.namedWindow("video")

cap = cv2.VideoCapture(1) time.sleep(3)

time.sleep(3)

while cv2.waitKey(1)!= 30: flag, frame = cap.read() cv2.imshow("video", frame)

frame) cap.release() cv2.destroyAllWindows()

cap.release() cv2.destroyAllWindows() and I have an error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow' 'cv::imshow'

How can I fix that? Thanks