我在Windows 7 32位操作系统中使用opencv 2.4.10和visual studio 2010 ...
由于我是这个领域的新手,首先我尝试显示图像......效果很好......但是当我显示视频时,我得到了这个例外......而且代码是提供如下...谢谢......
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
int main(int argc, char** argv)
{
string filename = "C:/Users/Public/Videos/Sample Videos/Wildlife.wmv";
VideoCapture capture(filename);
Mat frame;
if( !capture.isOpened() )
throw "Error when reading steam_avi";
namedWindow( "w", 1);
for( ; ; )
{
capture >> frame;
imshow("w", frame);
waitKey(20);
}
waitKey(0);
}
答案 0 :(得分:1)
尝试添加try { ... } catch(cv:Exception const& e){}
子句,以查看问题的e.what()
。
答案 1 :(得分:0)
它有效......
for( ; ; )
{
capture >> frame;
if ( frame.empty() )
break;
imshow("w", frame);
waitKey(33);
}