Hi I am trying to run the code below but having problems with the cvCreateFileCapture function.
#include "stdafx.h"
#include <iostream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
using namespace std;
int main( int argc, char** argv ) {
cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
// CvCapture* capture = cvCaptureFromAVI( argv[1] ); // either one will work
CvCapture* capture = cvCreateFileCapture( "test.avi");
IplImage* frame;
while(1) {
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Example2", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Example2" );
}
Initially I was getting an error about a missing msvcr90d.dll file. I had to download vs 2008 and change the platform toolset configuration settings. After I did this I got the error below. Any help would be much appreciated.
I bet cvCreateFileCapture()
is failing because it didn't found the file. You just don't know because you are not checking the return of the function.
It returns NULL
if it can't load the video file.
CvCapture* capture = cvCreateFileCapture("test.avi");
if (capture == NULL)
{
std::cout << "!!! cvCreateFileCapture failed !!!" << std::endl;
exit(0);
}
I have no idea what openCv is, but if memory serves me, msvcr90d.dll is the debug dll for VC++2008. Have you checked your project's configuration and properties to see what mode and what dlls it is using/importing?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.