+-
c – OpenCV waitKey()应返回-1但不返回
在 doc它说

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

但是当我的Ubuntu 14.04设备上没有按下任何键时,它返回255而不是-1.这是为什么?

代码示例:

#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()上进行了一些代码修改,并且还有一个关于此问题尚未合并的 fix.
点击查看更多相关文章

转载注明原文:c – OpenCV waitKey()应返回-1但不返回 - 乐贴网