#include <cv.h>
#include <highgui.h>
int main(int argc,char** argv[])
{
cvNamedWindow("video",CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateFileCapture("Input_1.avi");
if (!capture)
{
std::cout << "!!! cvCreateFileCapture didn't found the file !!!\n";
return -1;
}
IplImage* frame;
while(1)
{
frame = cvQueryFrame(capture);
if (!frame)
break;
cvShowImage("video",frame);
char c=cvWaitKey(40);
if (c==27)
break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("video");
}
这是我尝试过的代码。每当我按如下方式构建解决方案时,我都会收到警告:
Hello_World.cpp
1>c:\opencv231\include\opencv2\flann\logger.h(66): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(234) : see declaration of 'fopen'
1>c:\opencv231\include\opencv2\flann\flann.hpp(233): warning C4996: 'cv::flann::Index_<T>': was declared deprecated
1> c:\opencv231\include\opencv2\flann\flann.hpp(278) : see reference to class template instantiation 'cv::flann::Index_<T>' being compiled
1> Hello_World.vcxproj -> C:\Users\KARTHICK\Documents\Visual Studio 2010\Projects\Hello_World\Debug\Hello_World.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
即使我跑步,我也看不到视频流!当我按 ESC 键退出时,我有类似的东西
loaded , unloaded dlls ,cannot find or open PDB file ,
thread has exited with code 0 ,
Native has exited with code 0 .
请帮帮我。我只是opencv的初学者。谢谢你。