import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while True:
ret,frame = cap.read()
cv2.imshow('frame',frame)
k = cv2.waitKEy(10) & 0xff
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
Hi all I'm a beginner and I'm just trying to video capture using opencv but I'm just confused because I get:
error(-215) size.width>0 && size.height>0 in function imshow
and I cant find whats exactly wrong with it. Any help is greatly appreciated.
My exact error is
Traceback (most recent call last):
File "/home/pi/Desktop/videocapture.py", line 8,in <module>
cv2.imshow('frame',frame)
Error: /home/pi/opencv-3.0.0/modules/highgui/src/window.cpp:271: error: (-215) size.width>0 && size.height>0 in function imshow
And I tried a few other ways as well but and sometimes I will get scn == 3||scn == 4