summaryrefslogtreecommitdiff
path: root/megapixels/app/utils/display_utils.py
blob: 58e2feeccf630d942c3fa794243432dd7ab0adf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import sys

import cv2 as cv


def handle_keyboard():
  '''Used with cv.imshow('title', image) to wait for keyboard press
  '''
  while True:
    k = cv.waitKey(1) & 0xFF
    if k == 27 or k == ord('q'):  # ESC
      cv.destroyAllWindows()
      sys.exit()
    elif k != 255:
      # any key to continue
      break