summaryrefslogtreecommitdiff
path: root/megapixels/app/utils/display_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'megapixels/app/utils/display_utils.py')
-rw-r--r--megapixels/app/utils/display_utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/megapixels/app/utils/display_utils.py b/megapixels/app/utils/display_utils.py
new file mode 100644
index 00000000..58e2feec
--- /dev/null
+++ b/megapixels/app/utils/display_utils.py
@@ -0,0 +1,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 \ No newline at end of file