0
#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");
}
這是我試過的代碼。我收到警告,只要我建立的解決方案如下:在顯示opencv中的視頻時出錯
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的初學者。 謝謝。