Python3 can I replace waitKey() with an input using curses?
Python3...
Hello.I have a program and a part of it is to open a camera with opencv.
Another part of program is to give inputs using curses(curses do NOT wait/stop the other parts of program until user give an input )
So, when I open a camera AND then give an input the program sticks a little bit and this is very very bad.
I think the problem is to --> cv2.waitkey(1)
(Part of camera) ,because(maybe) waits for user input (I don't know)-> if(cv2.waitkey(1) == ord('q'):
Can I replace cv2.waitkey(1)
with the following ???
input = curses.initscr()
curses.noecho()
input.nodelay(1) # set getch() non-blocking
I don't want to wait for a key,because the other parts of program sticks.
Thanks!!
do you understand the difference between a console based an a gui based program ?
I asked if I can replace waitkey() function with an input that don't need to wait.
One mode comment:
waitKey
works in the window's event loop, while curses only works in the terminal (command line).So if the image window has focus, you have to use
waitKey
, but if the terminal has focus, you needgetch
to read a keystroke.