Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT OpenCV Video is not playing
Forum Updated to NodeBB v4.3 + New Features

QT OpenCV Video is not playing

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aniljoby
    wrote on 20 Jul 2014, 14:44 last edited by
    #1

    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&#40;&#41;;
    }
    
    while(1) {
    
    cap.read(src);
    .....................
    

    //processing codes here..
    ....................
    imshow( "Source", src );

    if(waitKey(30==27))
            break;
    

    }

    return a.exec&#40;&#41;;
    

    }

    }

    @

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Jul 2014, 14:53 last edited by
      #2

      Hi,

      "hand.MP4" is a relative path, so my guess is that the file is not found. Where is hand.MP4 located ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aniljoby
        wrote on 20 Jul 2014, 16:24 last edited by
        #3

        The file is stored in its build directory.
        Also i tried giving the complete path, but no use.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 20 Jul 2014, 21:25 last edited by
          #4

          Then you might be having a codec problem. Search for "opencv mp4", you'll get some useful hints to go further

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          3/4

          20 Jul 2014, 16:24

          • Login

          • Login or register to search.
          3 out of 4
          • First post
            3/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved