Ask Your Question

Revision history [back]

livestream closing with 0 entering

Hi,

my problem is that I cannot enter any letter or number. Actually I want to close the live stream with entering 0.

What did i do wrong?

#include <opencv2\opencv.hpp>
#include <opencv\highgui.h>

using namespace cv;
using namespace std;

int live()
{
    int eingabe;

    VideoCapture cam1(0);
    if (!cam1.isOpened()) cout << "Cam1 doesn't work" << endl;

    VideoCapture cam2(1);
    if (!cam2.isOpened()) cout << "R doesn't work" << endl;

    /*
    VideoCapture cam3(2);
    if (!cam3.isOpened()) cout << "R doesn't work" << endl;
    */

    Mat src1, src2, src3;

    while (1)
    {
        scanf("%d", &eingabe);

        cam1 >> src1;
        cam2 >> src2;
        // cam3 >> src3;
        imshow("Cam1", src1);
        imshow("Cam2", src2);
        // imshow("Cam3", src3);
        waitKey(1);

        if (eingabe == 0)
            break;
    }

    src1.release();
    src2.release();
    // src3.release();

    return 0;
}