“WaitKey di OpenCV” Kode Jawaban

WaitKey di OpenCV

cv2.waitKey() 
# function store 'key' that you press during output windows open, 
# also wait for certain amount of time

#if yoy press 'q' then cv2.waitKey(1) replace with ASCII value which is 113
if cv2.waitKey(1000) & 0xFF == ord('q'): # wait for 1000 millisecond
  break

# now your code will look like this
if 113 & 0xFF == ord('q'):
  break
VIvek

Contoh Opencv Waitkey

    if cv2.waitKey(1) & 0xFF == ord('q'): # wait for 1 millisecond
        break
Weary Wryneck

Opencv Waitkey

import numpy as np
import cv2

im = np.zeros((100, 300), np.uint8)
cv2.imshow('Keypressed', im)
while True:
  key = cv2.waitKey(0)
  im_c = im.copy()
  cv2.putText(
    im_c,
    f'{chr(key)} -> {key}',
    (10, 60), 
    cv2.FONT_HERSHEY_SIMPLEX, 
    1,
    (255,255,255),
    2)
  cv2.imshow('Keypressed', im_c)
  if key == 27: break # 'ESC'
ron schneider

Jawaban yang mirip dengan “WaitKey di OpenCV”

Pertanyaan yang mirip dengan “WaitKey di OpenCV”

Lebih banyak jawaban terkait untuk “WaitKey di OpenCV” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya