Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

this is code from the outdated opencv1.0 c-api. YOU MUST NOT USE IT ! (and if you were using a more recent opencv version, it would not let you !)

opencv moved to c++ a long time ago, you'll have to follow up.

no idea, where you found that code, but please throw it away, and rather have a look at current opencv tutorials

include "opencv2/opencv.hpp"

using namespace cv;

include <iostream>

using namespace std;

int main() { VideoCapture cap("path/to/my.avi"); if (! cap.isOpened()) { cout << "could not open the VideoCapture !" << endl; return -1; } while(true) { Mat frame; cap >> frame; if (frame.empty()) // movie is over { break; } imshow("ocv",frame); int k = waitKey(10); if (k==27) break; // esc. pressed } return 0; }

this is code from the outdated opencv1.0 c-api. YOU MUST NOT USE IT ! (and if you were using a more recent opencv version, it would not let you !)

opencv moved to c++ a long time ago, you'll have to follow up.

no idea, where you found that code, but please throw it away, and rather have a look at current opencv tutorials

include "opencv2/opencv.hpp"

#include "opencv2/opencv.hpp"
using namespace cv;

include <iostream>

cv; #include <iostream> using namespace std;

std; int main() { VideoCapture cap("path/to/my.avi"); if (! cap.isOpened()) { cout << "could not open the VideoCapture !" << endl; return -1; } while(true) { Mat frame; cap >> frame; if (frame.empty()) // movie is over { break; } imshow("ocv",frame); int k = waitKey(10); if (k==27) break; // esc. pressed } return 0; }

}

this is code from the outdated opencv1.0 c-api. YOU MUST NOT USE IT !

(and if you were using a more recent opencv version, it would not let you !)

opencv moved to c++ a long time ago, you'll have to follow up.

no idea, where you found that code, but please throw it away, and rather have a look at current opencv tutorials

#include "opencv2/opencv.hpp"
using namespace cv;

#include <iostream>
using namespace std;

int main()
{
    VideoCapture cap("path/to/my.avi");
    if (! cap.isOpened())
    {
        cout << "could not open the VideoCapture !" << endl;
        return -1;
    }
    while(true)
    {
        Mat frame;
        cap >> frame;
        if (frame.empty()) // movie is over
        {
            break;
        }
        imshow("ocv",frame);
        int k = waitKey(10);
        if (k==27) break;  // esc. pressed
    }
    return 0;
}