简体   繁体   中英

OpenCV waitKey() should return -1 but didn't

In the doc it says that

It returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.

But it returns 255 instead of -1 when no key is pressed on my Ubuntu 14.04 device. Why is that?

Code example:

#include <opencv/cv.hpp>
#include <iostream>

using namespace cv;

int main(void) {
    Mat image = Mat::zeros(100, 100, CV_8UC3);
    char window_name[] = "waitKey() example";
    imshow(window_name, image);

    const int DELAY = 50;
    int c = waitKey(DELAY);
    std::cout << c << std::endl;
}

最近对cv::waitKey()进行了一些代码修改,并且有关此问题的修复尚未合并。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM