I am new to OpenCV and simply trying to read in a video file and display it. Unfortunately, it looks like I can't even open the video. Any ideas on what may be preventing me from opening a video file? I can open images just fine. Can anyone help me out? Thanks so much.
Code:
import numpy as np
import cv2
cap = cv2.VideoCapture("F:\\OpenCV\\Cam1_Indoor.avi")
if cap.isOpened():
print "Opened"
else:
print "Not opened"
while(1):
ret, frame = cap.read()
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Output:
Not opened --------------------------------------------------------------------------- error Traceback (most recent call last) in () 11 while(1): 12 ret, frame = cap.read() ---> 13 cv2.imshow('frame',frame) 14 if cv2.waitKey(1) & 0xFF == ord('q'): 15 break
error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\highgui\src\window.cpp:271: error: (-215) size.width>0 && size.height>0 in function cv::imshow