Ask Your Question

Revision history [back]

Video play issue from file using OpenCV library in QT

Hi,

Am new to OpenCV, trying to play video from file from Qt but unsuccessful. Following is the code am trying int VideoTest::Videoplay() {

VideoCapture cap("/home/manu/Desktop/song.mp4"); if(!cap.isOpened()) // check if we succeeded return -1;

Mat edges; namedWindow("edges",1); for(;;) { Mat frame; cap >> frame; cvtColor(frame, edges, COLOR_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3); imshow("edges", edges); if(waitKey(30) >= 0) break; } return 0;

}

Instead of file name if i give camera number am able to open camera and display it, But video file is not opening. Please help with the solution.