Advertisement
dan-masek

Untitled

Feb 3rd, 2023
3,382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import numpy as np
  2. import cv2
  3.  
  4.  
  5. WINDOW_NAME = 'program'
  6. cv2.namedWindow(WINDOW_NAME, cv2.WINDOW_NORMAL)
  7. cv2.setWindowProperty(WINDOW_NAME, cv2.WND_PROP_FULLSCREEN,
  8.                       cv2.WINDOW_GUI_EXPANDED)
  9.  
  10. while True:
  11.     # Simplified image acquisition.
  12.     frame = (np.random.rand(1080, 1920, 3)*255).astype(np.uint8)
  13.  
  14.     cv2.imshow(WINDOW_NAME, frame)
  15.  
  16.     while True:
  17.         pressed_key_code = cv2.pollKey()
  18.         if pressed_key_code == -1:
  19.             print('no key')
  20.             break
  21.         if pressed_key_code == ord('q'):
  22.             exit()
  23.         elif pressed_key_code == ord('p'):
  24.             print('moving action')
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement