A real-time Computer Vision system translating hand gestures into Morse code, alphanumeric text, and spoken voice.
Key Features • Gesture Controls • System Architecture • Installation • Customization
The Live Morse Code Hand Translator is an assistive computer vision application that turns natural hand gestures into Morse code symbols (. and -), decodes them into full English sentences in real time, and vocalizes the result using an offline Text-to-Speech (TTS) engine.
Designed for full-screen conversational accessibility and hands-free input, the project features a responsive cyber-style Heads-Up Display (HUD), dynamic cooldown protection against accidental triggers, and a built-in Morse reference cheat sheet right beside the video feed.
- 🎨 High-Contrast Light Themes: Beautiful, modern light interface with Emerald Green and Sunset Orange color palettes (press
Tto toggle). - 🔍 Crystal-Clear Graphic Morse Glyphs: Custom anti-aliased solid circles and rounded bars replace tiny font dots, making Morse codes effortlessly readable from across the room.
- 💡 Live Candidate Preview: Instantly previews the letter you are currently forming (e.g.
INPUT: · — -> [ A ]) before you lock it in. - 🎯 Instant Letter Lock: A closed-fist gesture immediately commits and decodes the Morse sequence without waiting on an arbitrary timeout.
- 🗣️ Voice Output: Integrated offline Text-to-Speech (
pyttsx3) speaks your completed sentence on command. - 🖥️ Full-Screen HUD & 3-Column Sidebar: High-visibility split-screen layout showing your webcam feed, live input buffer, conversation history, and an ITU-R M.1677-1 verified alphanumeric Morse cheat sheet.
- ⏱️ Visual Cooldown Indicator: An on-screen timer bar prevents duplicate inputs and guarantees clean gesture recognition.
- ⌫ Full Editing Control: Built-in gestures to add spaces, backspace errors, or wipe the input buffer clean.
The system evaluates open vs. closed fingers using landmark geometry. Use the following gestures in front of the camera:
| Gesture | Pose / Landmark Trigger | Action | Behavior |
|---|---|---|---|
| ☝️ | 1 Finger (Index up) | Add Dot (.) |
Appends . to the active Morse buffer (repeats every 1.0s while held) |
| ✌️ | 2 Fingers (Index + Middle up) | Add Dash (-) |
Appends - to the active Morse buffer (repeats every 1.0s while held) |
| ✊ | Fist (All fingers & thumb closed) | Lock Letter | Decodes current Morse buffer into an alphabet letter |
| 👍 | Thumb Only (Fingers closed, thumb out) | Add Space | Appends a space ( ) to the conversation |
| 🤟 | 3 Fingers (Index, Middle, Ring up) | Backspace | Deletes the last character in the sentence |
| 🖖 | 4 Fingers (Index, Middle, Ring, Pinky up) | Speak Sentence | Reads out the entire sentence via Text-to-Speech |
| 🖐️ | Open Palm (All 5 fingers extended) | Clear Buffer | Clears the active Morse input buffer |
| 🙌 | Both Hands (Both hands raised) | Write to Paper | Saves conversation to paper_notes.txt & saved_conversations.txt |
💡 Tip: Hold 1 or 2 fingers steadily to stream multiple dots or dashes every second with the dynamic on-screen progress bar. Raise both hands at any time to write and export your sentence to paper notes.
flowchart LR
A[Webcam Feed] --> B[MediaPipe Hands\n21 3D Landmarks]
B --> C{Finger & Thumb\nGeometry Engine}
C -->|1 or 2 Fingers| D[Morse Buffer\n'.' or '-']
C -->|Fist Gesture| E[Dictionary Lookup\nAlphanumeric Char]
C -->|Thumb Gesture| F[Append Space]
C -->|3 Fingers| G[Backspace]
C -->|4 Fingers| H[pyttsx3 TTS Engine\nSpoken Audio]
C -->|5 Fingers| I[Wipe Buffer]
D --> J[OpenCV Fullscreen HUD\nLive Feed + HUD + Morse Key Sidebar]
E --> J
F --> J
G --> J
I --> J
- Landmark Analysis: The app compares the relative vertical coordinates of fingertip landmarks (
[8, 12, 16, 20]) against their corresponding lower PIP joints (tip - 2), while measuring the horizontal displacement of the thumb tip (4) relative to the wrist (0). - Debounce Engine: A 1.0-second delay timer prevents duplicate triggers while you hold or transition between gestures.
- Morse Translation: When a fist is shown, the accumulated dot/dash buffer is mapped against the international Morse alphabet dictionary and appended to your active sentence.
- Python 3.8 to 3.11
- A functional webcam
- An audio output device (speakers or headphones)
git clone https://github.com/kailash6207/Live-Morse-Code-Hand-Translator.git
cd Live-Morse-Code-Hand-Translator# Windows
python -m venv venv
venv\Scripts\activate
# macOS / Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txt(If on Linux, you may also need espeak: sudo apt-get install espeak)
python Main.pySpacebar: Append a space () to your sentence.Backspace: Delete the last dot/dash from the active buffer, or last letter from sentence.Enter: Speak the current conversation sentence aloud.e: Export conversation history to timestamped file (saved_conversations.txt).t: Toggle color theme (Emerald Green ⇄ Sunset Orange Light Themes).s: Toggle Audio feedback ON / OFF in real time.c: Clear the current sentence and input buffer.qorEsc: Exit the application.
You can easily tweak settings at the top of Main.py:
# Select default theme: 'green' or 'orange'
current_theme_key = 'green'
# Change the gesture debounce cooldown (in seconds)
DELAY_INTERVAL = 1.0 # Decrease to 0.7 for faster input once practiced
# Change TTS Speech Rate
engine.setProperty('rate', 160) # Adjust talking speed (default: 160 wpm)
# Adjust Hand Detection Sensitivity
hands = mp_hands.Hands(max_num_hands=1, min_detection_confidence=0.7)
# Customize Sound Frequencies & Durations
SOUND_EFFECTS = {
'dot': (1000, 80),
'dash': (1000, 240),
'lock': (1400, 90),
...
}Live-Morse-Code-Hand-Translator/
│
├── Main.py # Main application loop, CV pipeline, HUD, and TTS
├── requirements.txt # List of project dependencies
└── README.md # Project documentation
- Audio feedback (distinct asynchronous beeps for dots, dashes, and lock chimes)
- Support numbers (
0–9) and punctuation (?,,,.) - Non-blocking Text-to-Speech (camera loop never freezes during speech)
- Keyboard shortcuts (
Sfor audio,Cto clear,Tfor theme) - High-contrast light themes with Emerald Green & Sunset Orange color palettes
- Web-based interface using Streamlit or WebRTC
Developed by Kailash N H
⭐ If you enjoyed this project or found it helpful, feel free to give it a star!