This project is a real-time finger counting application that utilizes OpenCV and Mediapipe to track and detect raised fingers from a webcam feed. Additionally, it integrates text-to-speech functionality using pyttsx3 to announce the number of raised fingers aloud. The project is designed to work with a single hand and is useful for gesture-based applications, human-computer interaction, or accessibility solutions.
- Real-time hand tracking using MediaPipe
- Finger counting based on finger tip positions
- Visual overlay showing the number of raised fingers
- Text-to-speech output to announce the count
- Smooth performance with a webcam feed
- Python: Programming language used to develop the application.
- OpenCV: Used for video capture and image processing.
- MediaPipe: A framework for real-time hand tracking and gesture recognition.
- pyttsx3: A text-to-speech conversion library for Python.
- NumPy: (Implicitly used by OpenCV) for handling array operations efficiently.
- The webcam captures the video feed.
- OpenCV processes the frames, converting them to RGB format.
- MediaPipe detects the hand landmarks and extracts the key points.
- The program checks the relative positions of fingertips to count the number of raised fingers.
- The count is displayed on the screen using OpenCV.
pyttsx3announces the number of fingers raised when the count changes.
Ensure you have Python installed (preferably Python 3.7 or later). You also need to install the required dependencies.
- Clone the Repository (or create a new Python script and copy the code):
git clone https://github.com/ WazDevZmSimple-Finger-Counter-Using-Computer-Vision.git cd finger-counter - Create a Virtual Environment (Recommended):
python -m venv venv source venv/bin/activate # On macOS/Linux venv\Scripts\activate # On Windows
- Install Dependencies:
pip install opencv-python mediapipe pyttsx3 numpy
- Run the Script:
python main.py
- Usage:
- The program will launch your webcam and start detecting fingers.
- Show different numbers of fingers to see the count on the screen.
- The program will announce the number of raised fingers aloud.
- Press 'q' to exit the program.
- Support for multiple hands.
- Improved finger detection accuracy using deep learning.
- Gesture-based command execution (e.g., controlling system volume or media playback).
- UI-based interface instead of OpenCV window.
- Integration with IoT devices for smart home applications.
Developed by Wazingwa Mugala - Computer Engineering @ Copperbelt University (CBU).