Skip to content

Commit

Permalink
adding a key press to exit the image window
Browse files Browse the repository at this point in the history
The code used to ruin on an infinite while loop. I couldn't close the image window while the programming is running. Inorder to make it more user friendly I have just added a key press to close the window when an esc key or 'q' is pressed.
  • Loading branch information
vinaysannaiah committed Oct 30, 2018
1 parent 98198bf commit b34c5af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wrappers/python/examples/align-depth2color.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
images = np.hstack((bg_removed, depth_colormap))
cv2.namedWindow('Align Example', cv2.WINDOW_AUTOSIZE)
cv2.imshow('Align Example', images)
cv2.waitKey(1)
key = cv2.waitKey(1)
# Press esc or 'q' to close the image window
if key & 0xFF == ord('q') or key == 27:
cv2.destroyAllWindows()
break
finally:
pipeline.stop()

0 comments on commit b34c5af

Please sign in to comment.