c++ - cvCaptureFromFile- Opening Video from specific path - Raspberry Pi -
i have opencv-2.4.9 installed in raspberry pi. right trying load video specific path , tried both c , c++ api
c api: cvcapturefromfile(path);
c++ api: videocapture cap; cap.open(path)
i getting error , says not open file.
it works in windows , linux, not in raspberry pi. missing something?
c++ code:
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <opencv2/opencv.hpp> 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 code:
#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; } }
you have install uv4l driver.follow tutorial :
http://www.linux-projects.org/modules/sections/index.php?op=viewarticle&artid=14
Comments
Post a Comment