[英]OpenCV VideoCapture cannot read video in Python but able in VS11
作為標題,我無法使用以下代碼在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 \\ DLL以及PATH中都有以下dll
我不知道還沒做什么。
請幫我。 非常感謝你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.