I have installed OpenCV in Windows 7 (32 bit) and Put the cv2.pyd
file in Python Modules Directory and everything is working just fine but except opening of Video file {I have tried 5-6 different kind of extensions but nothing is helping} CODE::
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()
the line cap.isOpened()
always returns False {i also tried providing absolute path to the video file} but that too return false So please can please anybody help me that why that line is always returning False
我发现解决方案在C:\\opencv\\sources\\3rdparty\\ffmpeg\\opencv_ffmpeg.dll
存在一个文件,只需将该文件复制并粘贴到您的Python基本目录中,然后说C:\\Python\\opencv_ffmpeg.dll
并将文件重命名为您正在使用的OpenCV版本,例如我的v3.0.0,因此如果您的系统是X64,我必须将其重命名为C:\\Python\\opencv_ffmpeg300.dll
,然后在末尾添加_64,例如C:\\Python\\opencv_ffmpeg300_64.dll
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.