python下cv.waitKey無響應(yīng)的原因是什么-創(chuàng)新互聯(lián)

小編給大家分享一下python下cv.waitKey無響應(yīng)的原因是什么,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

成都創(chuàng)新互聯(lián)公司是一家集成都網(wǎng)站設(shè)計、網(wǎng)站制作、網(wǎng)站頁面設(shè)計、網(wǎng)站優(yōu)化SEO優(yōu)化為一體的專業(yè)網(wǎng)站設(shè)計公司,已為成都等多地近百家企業(yè)提供網(wǎng)站建設(shè)服務(wù)。追求良好的瀏覽體驗,以探求精品塑造與理念升華,設(shè)計最適合用戶的網(wǎng)站頁面。 合作只是第一步,服務(wù)才是根本,我們始終堅持講誠信,負責任的原則,為您進行細心、貼心、認真的服務(wù),與眾多客戶在蓬勃發(fā)展的市場環(huán)境中,互促共生。

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

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

int waitKey(int delay=0) 
- 延時delay = 0 函數(shù)則延時無限長,必須有鍵按下才繼續(xù)執(zhí)行。 
- 延時delay > 0 函數(shù)返回值為按下的鍵的ASCII碼值,超時則返回-1。
OpenCV: waitKey
waitKey 
Waits for a pressed key.
C++: int waitKey(int delay=0) 
Python: cv2.waitKey([delay]) → retval

Parameters: 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才有作用,否則無效。

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

以上是“python下cv.waitKey無響應(yīng)的原因是什么”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計公司行業(yè)資訊頻道!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

當前文章:python下cv.waitKey無響應(yīng)的原因是什么-創(chuàng)新互聯(lián)
當前鏈接:http://muchs.cn/article42/dpoiec.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、品牌網(wǎng)站設(shè)計、企業(yè)建站網(wǎng)站導航、建站公司、虛擬主機

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作