Created
January 16, 2020 10:13
-
-
Save shriyaRam/b05610458b46552b90d4f9a197aeea50 to your computer and use it in GitHub Desktop.
Gesture Recognition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Speak the sentence | |
if len(sentence) > 0 and c == ord('s'): | |
engine.say(sentence) | |
engine.runAndWait() | |
# Clear the sentence | |
if c == ord('c') or c == ord('C'): | |
sentence = "" | |
# Delete the last character | |
if c == ord('d') or c == ord('D'): | |
sentence = sentence[:-1] | |
# Put Space between words | |
if c == ord('m') or c == ord('M'): | |
sentence += " " | |
# If valid hand area is cropped | |
if hand.shape[0] != 0 and hand.shape[1] != 0: | |
conf, label = which(hand_bg_rm) | |
if conf >= THRESHOLD: | |
cv2.putText(frame, label, (90, 50), cv2.FONT_HERSHEY_COMPLEX_SMALL, .7, (0, 0, 255)) | |
if c == ord('n') or c == ord('N'): | |
sentence += label | |
cv2.putText(frame, sentence, (50, 70), cv2.FONT_HERSHEY_COMPLEX_SMALL, .7, (0, 0, 255)) | |
cv2.imshow(window_name, frame) | |
# If pressed ESC break | |
if c == 27: | |
cap.release() | |
cv2.destroyAllWindows() | |
exit() | |
cap.release() | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment