OpenCV的waitKey()应该返回-1,但没有 [英] OpenCV waitKey() should return -1 but didn't
本文介绍了OpenCV的waitKey()应该返回-1,但没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 doc 中,它说
它返回按下的键的代码;如果在指定的时间之前没有按下任何键,则返回-1.
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.为什么会这样?
But it returns 255 instead of -1 when no key is pressed on my Ubuntu 14.04 device. Why is that?
代码示例:
#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()
上进行了一些代码修改,并且有一个
recently some code modification has made on cv::waitKey()
and there is a fix about this issue not merged yet.
这篇关于OpenCV的waitKey()应该返回-1,但没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文