namedWindow + imshow not showing on the screen

asked 2017-03-21 23:21:58 -0500

sep_vanmarcke gravatar image

updated 2017-03-21 23:22:28 -0500

I can't get the window with the video to show on the screen. The light of the web camera flashes so it opens it and the program is in infinite loop when i run yet nothing shows on the screen.

#include <iostream>
#include <string>
#include <sstream>

#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>

using namespace cv;

int main(int argc, char **argv) {

    VideoCapture cap(0);
    namedWindow("video", WINDOW_NORMAL);
    while (1) {
        Mat frame;
        cap >> frame;
        imshow("video", frame);
        if (waitKey(30) >= 0) break;
    }
    cap.release();
    return 0;
}
edit retag flag offensive close merge delete

Comments

1

This question has nothing to do with ROS. Please ask it in http://answers.opencv.org

Martin Peris gravatar image Martin Peris  ( 2017-03-21 23:33:57 -0500 )edit