cvCaptureFromFile-从特定路径打开video – Raspberry Pi

我在Raspberry Pi中安装了OpenCV-2.4.9。 现在我正在尝试从特定路径加载video,为此我尝试使用C和C ++ API

C API:cvCaptureFromFile(path);

C ++ API:VideoCapture上限; cap.open(路径)

我收到错误,它说无法打开文件。

它适用于Windows和Linux,但不适用于Raspberry Pi。 我错过了什么吗?

C ++代码:

#include  #include  #include  #include  #include  using namespace cv; using namespace std; int main(){ VideoCapture cap("C:/Users/nava/Videos/file.mp4"); if (!cap.isOpened()){ cout << "Error opening video stream" << endl; return -1; } while (1){ Mat Frame; if (!cap.read(Frame)){ cout << "No Frame available" << endl; waitKey(); } imshow("output", Frame); if (waitKey(33) == 27) break; } } 

C代码:

 #include "highgui.h" int main(int argc, char** argv) { cvNamedWindow("video",CV_WINDOW_AUTOSIZE); CvCapture* capture = cvCreateFileCapture("/home/pi/Desktop/test.mp4"); IplImage* frame; while(1) { frame = cvQueryFrame(capture); if(!frame) break; cvShowImage("video", frame); char c = cvWaitKey(33); if(c == 27) break; } } 

你必须安装UV4L驱动程序。遵循本教程:

http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=14