A professional, beginner-friendly web application for real-time sign language recognition using Flask, OpenCV, and MediaPipe. Perfect for a second-year computer engineering student's project.
This project detects 12 common sign language gestures using a webcam and converts them to text in real-time. The system is built with a clean web interface and stores all recognized signs in a database.
Key Features:
- β Real-time webcam gesture detection
- β 12 common sign language gestures recognized
- β Web-based interface (HTML/CSS/JavaScript)
- β SQLite database for storing predictions
- β Dashboard with statistics
- β Clean, modular code structure
- β Fully commented for learning
sign_language_converter/
βββ app.py # Main Flask application (entry point)
βββ config.py # Configuration settings
βββ database.py # Database operations
βββ gesture_model.py # Gesture recognition logic
βββ camera_module.py # Webcam capture and streaming
βββ requirements.txt # Python dependencies
βββ templates/
β βββ index.html # Main web page
βββ static/
β βββ css/
β β βββ style.css # Styling and layout
β βββ js/
β βββ script.js # Frontend interactivity
βββ uploads/ # Folder for captured frames (optional)
βββ sign_language_database.db # SQLite database (auto-created)
- THUMBS UP - Thumb extended upward
- THUMBS DOWN - Thumb pointing downward
- OK SIGN - Thumb and index forming circle
- PEACE SIGN - Index and middle fingers extended
- OPEN PALM - All five fingers extended
- CLOSED FIST - All fingers folded
- POINTING - Only index finger extended
- ROCK SIGN - Index and pinky extended
- LOVE YOU - Index, middle, and pinky extended
- CALL ME - Thumb and pinky forming phone shape
- VICTORY - Middle and ring fingers extended
- THUMBS SIDEWAYS - Thumb pointing sideways
# Navigate to project folder
cd sign_language_converter
# Install required packages
pip install -r requirements.txtWhat gets installed:
Flask- Web framework for backendopencv-python- Computer vision librarymediapipe- Hand detection and trackingnumpy- Numerical computing
python app.pyExpected output:
============================================================
Sign Language to Text Converter - Flask App
============================================================
Starting server...
Open browser and go to: http://localhost:5000
Press CTRL+C to stop the server
============================================================
Go to: http://localhost:5000
- Click "Start Camera" button
- Make hand gestures in front of webcam
- Recognized signs appear in the list
- View statistics on the dashboard
β
Lightweight - Perfect for college projects
β
Python-based - Easy to understand and modify
β
Great documentation - Lots of tutorials available
β
Suitable for beginners - Not overly complex
β
Can scale - Can be deployed to production later
β
No server needed - Database is just a file
β
Built into Python - No setup required
β
Perfect for college projects - Lightweight
β
Easy to backup - Single file format
β
Good enough for this scale - Thousands of records
β
Industry standard - Used in real computer vision
β
Works with all webcams - Universal compatibility
β
Fast and efficient - Good performance on laptops
β
Easy to use - Clear API and documentation
β
Widely used - Many examples and tutorials
β
Pre-trained model - Doesn't require GPU
β
Fast detection - Works smoothly on CPU
β
Accurate hand tracking - 21 key points per hand
β
Easy integration - Clean Python API
β
Google-backed - Continuously improved
User clicks "Start Camera"
β
JavaScript calls /start_camera endpoint
β
Flask opens webcam and starts streaming
β
Video displayed in <img> tag (MJPEG stream)
β
JavaScript polls /api/detect_gesture every 100ms
β
MediaPipe detects hand and landmarks
β
Gesture logic analyzes finger positions
β
If gesture detected β Save to SQLite database
β
JSON response sent to JavaScript with gesture name
β
JavaScript updates UI with detected gesture
β
Database predictions fetched and displayed
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WEB BROWSER (Frontend) β
β ββββββββββββββββββββββββββββββββββββββββββββββ β
β β HTML (Structure) β β
β β CSS (Styling) β β
β β JavaScript (Interactivity) β β
β ββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β HTTP Requests/Responses
ββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β FLASK BACKEND (Python) β
β ββββββββββββββββββββββββββββββββββββββββββββ β
β β app.py (Main application) β β
β β Routes: /start_camera, /video_feed, etc β β
β ββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β Imports
ββββββββββ΄βββββββββ¬βββββββββββββββ¬βββββββββββββ
βΌ βΌ βΌ βΌ
βββββββββββ ββββββββββββββββ ββββββββββββ ββββββββββ
β config β β database.py β β camera β βgesture β
β .py β β β β_module.pyβ β_model β
β β β SQLite Ops β β OpenCV β β.py β
βββββββββββ β Storing Data β β Streamingβ βMediaPipe
ββββββββββββββββ ββββββββββββ βDetection
βΌ
βββββββββββββββ
β SQLite β
β Database β
β (.db file) β
βββββββββββββββ
Hand Detection (MediaPipe):
- Input: Video frame from webcam
- Process: Detects hand and extracts 21 key points
- Output: Coordinates of finger tips, joints, wrist
Finger State Analysis:
- Compare each finger's tip position with its PIP joint
- If tip is further than PIP β finger is extended
- Return boolean for each finger (true/false)
Gesture Logic (Rule-based):
- Combine finger states with distance calculations
- Example: PEACE SIGN = Index AND Middle extended, Ring AND Pinky NOT extended
- Pattern matching approach (not ML classification)
For College Project:
β
Easier to understand and explain
β
Doesn't require training data
β
Works immediately (no training time)
β
Easy to modify/add new gestures
β
Perfect for demonstration
For Production:
β Less flexible if rules get complex
β Harder to handle edge cases
β Manual tuning needed
Each detection is stored as:
ββ id: Unique identifier (1, 2, 3, ...)
ββ gesture: Text of recognized sign ("THUMBS UP")
ββ timestamp: When it was detected (2024-02-05 10:30:45)
ββ confidence: How confident (0.9)
Query Examples:
- Get all predictions: SELECT * FROM predictions
- Count by gesture: SELECT gesture, COUNT(*) FROM predictions GROUP BY gesture
- Get recent: SELECT * FROM predictions LIMIT 10 ORDER BY timestamp DESC
A:
- Background lighting affects hand detection (solved by better lighting)
- Fast hand movements can miss detection (solved by frame buffering)
- False positives from similar gestures (solved by confidence threshold)
A:
- Pattern matching with MediaPipe is simpler and faster
- Doesn't require GPU (works on normal laptops)
- Google's pre-trained model is reliable and accurate
- Easy to debug and modify (no black-box ML model)
A:
- JavaScript sends HTTP requests (GET/POST)
- Flask backend processes requests and returns JSON
- JavaScript updates HTML dynamically with responses
- No page reload needed (AJAX - Asynchronous JavaScript)
A:
- No server setup required
- Perfect for college projects (simple deployment)
- Single file database (easy backup)
- Good enough for this scale
- If needed more users, can migrate to MySQL later
A:
Yes! To add a new gesture:
1. Identify which fingers should be up/down
2. Add new condition in detect_gesture() function
3. Update gesture list in config.py
4. Done! No retraining needed
- Open
gesture_model.py - Add new condition in
detect_gesture()function:
# New gesture: SHAKA SIGN (pinky and thumb extended)
if (fingers['thumb'] and fingers['pinky'] and
not fingers['index'] and not fingers['middle'] and not fingers['ring']):
return "SHAKA SIGN"- Add to
config.pygesture list - Done!
- Adjust confidence thresholds in
config.py - Modify detection logic in
gesture_model.py - Test with different hand positions
- Check terminal output (already has detailed logging)
- Add more
print()statements for debugging - Check console in browser (F12 β Console)
- Check if another app is using camera
- Try closing browser and restarting
- Restart Python application
- Check if camera is connected
- Ensure good lighting
- Show gesture clearly to camera
- Check if gesture is in supported list
- Adjust hand distance from camera
- Camera might not be started
- Check browser console for errors (F12)
- Check Flask terminal for error messages
- Refresh page and try again
- Close other applications
- Reduce video resolution (edit config.py)
- Reduce gesture detection frequency
- Check CPU usage
- Lines of Code: ~2000 (including comments)
- Number of Modules: 6 (modular design)
- Number of Gestures: 12 (extensible)
- UI Responsiveness: Mobile, Tablet, Desktop
- Database Scalability: Up to 100,000+ records
- No GPU Required: Runs on standard laptop
- Modular architecture (separation of concerns)
- Clear function documentation
- Comprehensive comments for learning
- Proper error handling
- Database abstraction
- Backend (Python Flask)
- Frontend (HTML/CSS/JavaScript)
- Database (SQLite)
- Real-time communication (HTTP APIs)
- Easy to understand and explain
- Real-world applicable
- Demonstrates proper coding practices
- Professional UI/UX
- Scalable architecture
- Code is well-commented
- Architecture is clearly explained
- Easy to answer technical questions
- Can show live demo
- Easy to modify and extend during viva
python app.pypip install -r requirements.txthttp://localhost:5000
1. Browser Console (F12 β Console)
2. Flask Terminal (where you ran python app.py)
3. SQLite Database (sign_language_database.db)
This project demonstrates:
- Full-stack development (backend + frontend + database)
- Computer vision (hand detection and gesture recognition)
- Web development (Flask, REST APIs, HTML/CSS/JS)
- Software engineering (modular design, documentation)
- Problem-solving (real-time processing, accuracy improvements)
Perfect for a college project that will impress your evaluators! π
This project is for educational purposes. Free to use and modify.
Last Updated: February 2024
Version: 1.0
Status: Production Ready for College Projects β