I am going thru the tutorials to learn OpenCV. And I have a problem. When I run this code:
import cv2
cap = cv2.VideoCapture('C:\Users\wg\174037210.avi')
while(cap.isOpened()):
ret, frame = cap.read()
cv2.imshow('Video', frame)
if cv2.waitKey(75) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
which is plain vanilla code I get this error after the video finishes: Traceback (most recent call last): File "C:/Users/wg/python/video-test.py", line 15, in <module> cv2.imshow('Video', frame) cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
The environment is as follows: Windows 7 Professional Python 3.6.5 OpenCV 3.4.3
Any help is greatly appreciated. Thanks!