Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV crashes after playing a video... help.. please!

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')
    ret, frame =
    cv2.imshow('Video', frame)
    if cv2.waitKey(75) & 0xFF == ord('q'):
which is plain vanilla code I get this error after the video finishes:

Traceback (most recent call last): File "C:/Users/wg/python/", 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!