Skip to content

Commit

Permalink
When Ctrl-C is pressed, only use the Exception handler to break out o…
Browse files Browse the repository at this point in the history
…f the main loop. At the end of the method, we destroy all windows and exit the program
  • Loading branch information
Guido Diepen committed Feb 27, 2017
1 parent 2f20ab2 commit 0848ec1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions track multiple faces/demo - track multiple faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,14 @@ def detectAndTrackMultipleFaces():


#To ensure we can also deal with the user pressing Ctrl-C in the console
#we have to check for the KeyboardInterrupt exception and destroy
#all opencv windows and exit the application
#we have to check for the KeyboardInterrupt exception and break out of
#the main loop
except KeyboardInterrupt as e:
cv2.destroyAllWindows()
exit(0)
pass

#Destroy any OpenCV windows and exit the application
cv2.destroyAllWindows()
exit(0)


if __name__ == '__main__':
Expand Down

0 comments on commit 0848ec1

Please sign in to comment.