我試圖'do more some stuff'在's'按下之后。'do more some stuff'收到輸入后按任意/特定鍵將觸發's'。因為'do more some stuff'依賴于'do stuff'.我到目前為止嘗試過這些。
while True:
kk = cv2.waitKey(1)
if kk == ord('s'):
# Do stuff
input("Press any key to continue")
# Do more stuff
和
while True:
kk = cv2.waitKey(1)
if kk == ord('s'):
# Do stuff
print("Press c to continue")
if kk == ord('c'):
# Do more stuff
uj5u.com熱心網友回復:
您可以再次使用 cv2.waitKey 而不是使用輸入。
import cv2
img = cv2.imread("D://Code//01.Python//yolov5//runs//detect//exp8//3.jpg")
cv2.imshow("name", img)
kk = cv2.waitKey(0)
if kk == ord('s'):
print("Do stuff")
tmp = cv2.waitKey(0)
print("Do More Stuff")

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/515001.html
標籤:Pythonopencv
