Robotics StackExchange | Archived questions

namedWindow + imshow not showing on the screen

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;
}

Asked by sep_vanmarcke on 2017-03-21 23:21:58 UTC

Comments

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

Asked by Martin Peris on 2017-03-21 23:33:57 UTC

Answers