QT OpenCV Video is not playing
-
I am on the way to develop a hand gesture controlled robot. But for processing i can't open any video files. The code used for the video is
@
#include <QCoreApplication>
#include <opencv/highgui.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <stdio.h>
#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv/cv.h>
#include <opencv2/video/video.hpp>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);Mat src_gray,src;
namedWindow( "Source",0 );
VideoCapture cap( "hand.MP4");
if(!cap.isOpened()){ cout<<"not open"; return a.exec(); } while(1) { cap.read(src); .....................
//processing codes here..
....................
imshow( "Source", src );if(waitKey(30==27)) break;
}
return a.exec();
}
}
@
But every time output is "not open";
Can you please suggest whats gone wrong in my code.
I am using windows 8.1, opencv 2.4.9, QT 5.2.1.
Thanks. -
Hi,
"hand.MP4" is a relative path, so my guess is that the file is not found. Where is hand.MP4 located ?
-
Then you might be having a codec problem. Search for "opencv mp4", you'll get some useful hints to go further