A computer vision system that detects left and right hands to assist in recognizing American Sign Language (ASL) gestures. This project uses OpenCV and Mediapipe to identify and crop hand regions from webcam video in real time, saving them for dataset creation and further training.
β
Real-time detection of left and right hands
β
Automatic cropping and saving of detected hands
β
Adjustable offset and image size for better framing
β
Label assignment to different ASL gestures
β
Built with Python, OpenCV, and Mediapipe
- Clone the repository
git clone https://github.com/yourusername/HandSignDetectionn.git cd HandSignDetectionn
(Optional but recommended) Create a virtual environment
bash Copy Edit python -m venv .venv source .venv/bin/activate # macOS/Linux .venv\Scripts\activate # Windows Install dependencies
bash Copy Edit pip install -r requirements.txt βοΈ Usage Run the data collection script to start capturing images:
bash Copy Edit python dataCollection.py By default, images will be saved under the Data/ folder with subfolders based on your assigned labels.
Edit dataCollection.py to change:
offset β Margin around the cropped hand
imgSize β Output image size (default: 300Γ300)
folder β Data save location
labels β List of labels for your ASL signs
Press q in the OpenCV window to exit the program.
π οΈ Project Structure bash Copy Edit HandSignDetectionn/ βββ dataCollection.py # Main hand detection & data collection script βββ test.py # Script for testing detection (optional) βββ Data/ # Folder for collected hand images βββ README.md # Project documentation βββ requirements.txt # Python dependencies β Troubleshooting cv2.error: ... !ssize.empty() This error occurs if no hand is detected in the frame. Make sure your webcam is active and your hand is visible.
Cannot open camera Check your webcam permissions or try restarting your computer.
ποΈ Contributing Contributions are welcome! You can:
Add new ASL gestures or improve label handling.
Optimize detection accuracy.
Create a GUI for easier usage.
Train a full ASL recognition model using collected data.
To contribute:
Fork the repo
Create a new branch (git checkout -b feature/YourFeature)
Commit your changes
Push to your branch and open a pull request
π License This project is licensed under the MIT License.
π Acknowledgements OpenCV β Computer vision library
Mediapipe β Real-time hand tracking
Python β The language powering it all
β If you find this project helpful, consider giving it a star on GitHub!
yaml Copy Edit
- Save this text as a
README.mdfile at your project root. - Commit and push it to GitHub:
git add README.md git commit -m "Add complete project README" git push origin main