Error opening file (/home/vaibhav/opencv/modul

2020-02-26 02:00发布

I am using OpenCV to display a video my code is as

#include<opencv2/highgui.hpp>
#include<cv.h>
#include<opencv/cv.hpp>
#include<opencv2/opencv.hpp>
#include<cvaux.h>
#include<cxcore.h>
#include<stdio.h>
#include<highgui.h>
#include<stdlib.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
int main( int argc, char ** argv )
{
CvCapture* capture;
cvNamedWindow( "video", CV_WINDOW_AUTOSIZE ); 
capture = cvCreateFileCapture("/home/vaibhav/program/c/w.avi");
IplImage* frame;
while(1){
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "video", frame );
char c = cvWaitKey(33);
if( c == 27 ) break;
}

cvReleaseCapture( &capture );

cvDestroyWindow( "Webcam" );

return 0; }

The program compiles but it gives error when try to run it

I am using Ubuntu 12.04 and Eclipse

warning: Error opening file (/home/vaibhav/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:553)

标签: opencv
8条回答
再贱就再见
2楼-- · 2020-02-26 02:27

I just used double quotes instead of single quotes using the entire video path and it worked for me! (on windows)

查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-02-26 02:30

to clear up some confusion here:

the error means, that it could not find or open your Video file. (either file not found, or codec not present)

"/home/vaibhav/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:553" is just the location of the code, where the error is thrown.

(and please, don't use the deprecated c-api any longer, they stopped developing it like 5 years ago, switch over to the c++ one. )

查看更多
登录 后发表回答