Im trying to get the frames from my camera with following basic code :
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True :
ret,frame = cap.read()
print(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
But I'm getting this error :
None
OpenCV(3.4.1) Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /tmp/opencv-20180307-44253-2moj1c/opencv-3.4.1/modules/highgui/src/window.cpp, line 356
Traceback (most recent call last):
File "video_cap_opencv.py", line 11, in <module>
cv2.imshow('frame',frame)
cv2.error: OpenCV(3.4.1) /tmp/opencv-20180307-44253-2moj1c/opencv-3.4.1/modules/highgui/src/window.cpp:356: error: (-215) size.width>0 && size.height>0 in function imshow
Knowing the same code worked well for me before, What could be causing this ?