Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

waitkey in 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
Comment

opencv waitkey example

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

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'
Comment

PREVIOUS NEXT
Code Example
Python :: pandas create a calculated column 
Python :: change colorbar size and place python 
Python :: Python Tkinter TopLevel Widget Syntax 
Python :: round up division python 
Python :: define empty numpy array 
Python :: convert index of a pandas dataframe into a column 
Python :: opencv dilate 
Python :: how to unique list in python 
Python :: python add element to array 
Python :: assign python 
Python :: how to read numbers from a text file in python 
Python :: remove specific word from string using python 
Python :: Replace the string with NAN value 
Python :: install python 3.6 on centos 
Python :: reverse key order dict python 
Python :: get rid of unnamed column pandas 
Python :: pandas python group by for one column and sum another column 
Python :: python function as parameter 
Python :: remove extra spaces python 
Python :: python array to string 
Python :: pygame how to draw a rectangle 
Python :: pandas sort by columns 
Python :: pyspark left join 
Python :: keras example 
Python :: How to check for palindromes in python 
Python :: tf-idf python implementation 
Python :: subprocess.check_output python 
Python :: creating data frame in python with for loop 
Python :: RuntimeError: Broken toolchain: cannot link a simple C program 
Python :: json url to dataframe python 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =