This project uses OpenCV to recognize hand gestures in real-time via a webcam. The program detects the hand and counts the number of fingers raised based on the convexity defects in the hand contour.
- Real-time hand gesture recognition using webcam.
- Detects the number of fingers raised.
- Uses convexity defects for finger detection.
- Works on most webcams.
To run this project, you will need to install the following Python libraries:
- OpenCV: For image processing and computer vision tasks.
- NumPy: For numerical operations (specifically for vector math).
You can install these libraries using pip:
pip install opencv-python opencv-python-headless numpy
The project consists of a single Python script:
- main.py: The main script that captures webcam feed, processes the image, detects hand contours, and counts the number of fingers.
- Ensure that you have Python 3.x installed on your machine.
- Install the required libraries by running the command:
pip install opencv-python opencv-python-headless numpy
- Clone or download the project.
- Open a terminal or command prompt and navigate to the directory containing
main.py
. - Run the script:
python main.py
- A window will appear showing the webcam feed with hand gesture recognition. The program will print the number of fingers detected in the console.
- To exit the program, press the
q
key.
- Improve finger detection accuracy for more complex gestures.
- Add gesture-based control to interact with the computer (e.g., mouse control).
- Implement a model to recognize different hand gestures for control purposes.
This project is open-source and available under the MIT License. See the LICENSE file for more information.