Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

waitkey() does not return the value of the character pressed

The code below does not pause indefinitely. Instead prints the '-1' indefinitely. Please help.

#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <opencv2/opencv.hpp>
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;

int main(){

    int ch;

    while (1)
    { 
        ch = waitKey(0);
        cout << ch << endl;
    }
    return 0;
}