【发布时间】:2013-04-28 18:50:36
【问题描述】:
作为标题,我无法通过以下代码在 python 中使用 VideoCapture 读取视频:
v = 'C:\\test.mp4'
import cv2
cap = cv2.VideoCapture(v)
if cap.isOpened():
print "Finally"
else:
print "BOOM"
BOOM 总是被打印出来。 叹息
而在 VS11 中,以下代码有效:
#include "stdafx.h"
#include <opencv2\highgui\highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
string v = "C:\\test.mp4";
VideoCapture cap;
cap.open(v);
if (cap.isOpened()) {
cout << "Yes!" << endl;
} else {
cout << "BOOM" << endl;
}
return 0;
}
我确实意识到 SO 中有一个数字解决方案,但对我没有任何作用。 我在 C:\Python27 和 C:\Python27\DLLs 以及 PATH 中有以下 dll
- opencv_ffmpeg.dll
- opencv_ffmpeg_64.dll
- opencv_ffmpeg_245_64.dll
- opencv_ffmpeg_245.dll
我不知道还有什么没做。
请帮助我。非常感谢。
【问题讨论】: