I am coding OpenCV with Python. I can't figure out how to read a video with cv2.VideoCapture().
It is working fine with my webcam but doesn't return anything not even any error messages when I run the code below:
import numpy as np
import cv2
cap = cv2.VideoCapture('vtest.avi')
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
For what I did to solve this was:
1.used
cap = cv2.VideoCapture("C:\vtest.avi") (nothing happened)
2.copied
The opencv_ffmpeg_64.dll to the base location(C:\Python27) even in
the folder called DLLs(C:\Python27\DLLs) but nothing is working .