什么是OpenCV中的cvWaitKey()函数呢? [英] What does OpenCV's cvWaitKey( ) function do?

查看:534
本文介绍了什么是OpenCV中的cvWaitKey()函数呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cvWaitKey的执行过程中会发生什么()?什么是一些典型应用案例?只见它的 OpenCV的的参考,但该文件是不是它的确切目的明确。

What happens during the execution of cvWaitKey()? What are some typical use cases? I saw it in OpenCV reference but the documentation isn't clear on its exact purpose.

推荐答案

cvWaitKey(X)/ CV :: waitKey(X)做了两件事:


  1. 它等待的 X 毫秒为单位OpenCV的窗口上的一个键preSS(即从创建简历:: imshow()) 。请注意,它不会对标准输入控制台输入听。如果一个关键是在这段时间pssed $ P $,它返回键的ASCII code。否则,它返回 1 。 (如果的 X 为零,它会无限期地等待关键preSS)

  2. 它可以处理任何窗口的事件,如 CV创建窗口:: namedWindow(),或显示与图片CV :: imshow()

  1. It waits for x milliseconds for a key press on a OpenCV window (i.e. created from cv::imshow()). Note that it does not listen on stdin for console input. If a key was pressed during that time, it returns the key's ASCII code. Otherwise, it returns -1. (If x is zero, it waits indefinitely for the key press.)
  2. It handles any windowing events, such as creating windows with cv::namedWindow(), or showing images with cv::imshow().

有关OpenCV的新手常犯的错误是调用 CV :: imshow()通过视频帧的循环,而不遵循了每次抽奖CV :: waitKey(30)。在这种情况下,没有出现在屏幕上,因为highgui从未给定的时间来处理来自 CV :: imshow()

A common mistake for opencv newcomers is to call cv::imshow() in a loop through video frames, without following up each draw with cv::waitKey(30). In this case, nothing appears on screen, because highgui is never given time to process the draw requests from cv::imshow().

这篇关于什么是OpenCV中的cvWaitKey()函数呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆