cv2.Videocapture () works fine when using a webcam, but when trying to read from the hard drive, the error cap.isOpened () returns false
import cv2 import numpy as np background=cv2.imread('background.png') cap = cv2.VideoCapture('car video.mp4') cap.open('car video.mp4') print cap.isOpened() while 1: ret,img=cap.read() cv2.imshow('a',img) print img.shape if cv2.waitKey(1) & 0xFF == ord('q'): break cap.release() cv2.destroyAllWindows()
He shows this error
cv2.imshow('a',img) error: ..\..\..\..\opencv\modules\highgui\src\window.cpp:266: error: (-215) size.width>0 && size.height>0 in function cv::imshow
my opencv version 3.0.0, python 2.7, windows10 32 bit
source share