国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

關于python下cv.waitKey無響應的原因及解決方法

2020-02-16 00:34:12
字體:
來源:轉載
供稿:網友

按下鍵的時候,焦點要落在窗口上,不能落在cmd窗口上。

另外,一般在imshow()后要使用waitKey(),給圖像繪制留下時間,不然窗口會出現(xiàn)無響應情況,并且圖像無法顯示出來。

int waitKey(int delay=0) - 延時delay = 0 函數則延時無限長,必須有鍵按下才繼續(xù)執(zhí)行。 - 延時delay > 0 函數返回值為按下的鍵的ASCII碼值,超時則返回-1。OpenCV: waitKeywaitKey Waits for a pressed key.C++: int waitKey(int delay=0) Python: cv2.waitKey([delay]) → retvalParameters: delay – Delay in milliseconds. 0 is the special value that means “forever”.The function waitKey waits for a key event infinitely (when /texttt{delay}/leq 0 ) or for delay milliseconds, when it is positive. Since the OS has a minimum time between switching threads, the function will not wait exactly delay ms, it will wait at least delay ms, depending on what else is running on your computer at that time. It returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.Note This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing unless HighGUI is used within an environment that takes care of event processing.Note The function only works if there is at least one HighGUI window created and the window is active. If there are several HighGUI windows, any of them can be active.

也就是說必須在有窗口顯示的情況下,waitKey才有作用,否則無效。

比如調用cv.waitKey(0),如果此時沒有活動的窗口,該函數立刻返回-1

以上這篇關于python下cv.waitKey無響應的原因及解決方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林站長站。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 元朗区| 赣榆县| 井研县| 呼伦贝尔市| 逊克县| 凭祥市| 福建省| 璧山县| 虎林市| 兴海县| 拉孜县| 呼伦贝尔市| 新兴县| 丹寨县| 遵化市| 宜川县| 汉源县| 台江县| 双牌县| 庐江县| 新兴县| 米林县| 铁岭县| 武夷山市| 青龙| 清流县| 阳朔县| 老河口市| 辽中县| 漯河市| 靖西县| 遵义县| 宁城县| 宁南县| 阜康市| 荣成市| 威远县| 政和县| 贵德县| 绥滨县| 高唐县|