videoread.exe 中 0x7548812f (KernelBase.dll) 的第一次机会异常:Microsoft C++ 异常:cv::Exception 在内存位置 0x002cf898
First-chance exception at 0x7548812f (KernelBase.dll) in videoread.exe: Microsoft C++ exception: cv::Exception at memory location 0x002cf898
我在 Windows 7 32 位 OS...
中使用带有 visual studio 2010 的 opencv 2.4.10
因为我是这个领域的新手,首先我尝试显示图像...效果很好...但是当我显示视频时,我遇到了这个异常...下面提供了代码...谢谢...
#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);
}
尝试添加 try { ... } catch(cv:Exception const& e){}
子句,查看 e.what()
问题。
有效...
for( ; ; )
{
capture >> frame;
if ( frame.empty() )
break;
imshow("w", frame);
waitKey(33);
}
我在 Windows 7 32 位 OS...
中使用带有 visual studio 2010 的 opencv 2.4.10因为我是这个领域的新手,首先我尝试显示图像...效果很好...但是当我显示视频时,我遇到了这个异常...下面提供了代码...谢谢...
#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);
}
尝试添加 try { ... } catch(cv:Exception const& e){}
子句,查看 e.what()
问题。
有效...
for( ; ; )
{
capture >> frame;
if ( frame.empty() )
break;
imshow("w", frame);
waitKey(33);
}