HandTracker is a Python-based project that uses computer vision to detect and track hands in real-time using a webcam. This project leverages the power of cvzone and opencv-python libraries to achieve hand detection and finger recognition.
Features Real-time hand detection and tracking. Finger recognition to identify which fingers are up. Easy to use and extend for various hand gesture applications.
To get started with HandTracker, you'll need to install the required dependencies. You can do this using pip:
bash pip install cvzone opencv-python
Video Capture: The script starts by capturing video from the default webcam. Hand Detection: It then initializes the hand detector using cvzone's HandDetector module. Hand Tracking: In each frame, it detects hands and draws landmarks on the detected hands. Finger Recognition: The script prints the status of fingers (whether each finger is up or down) to the console. Display: The processed video is displayed in a window. Press 'q' to exit the program.
Extending the Code - Here is an example to extend the project for recognizing the "punch" gesture (all fingers down) and the "hi" gesture (all fingers up):
if fingers == [0, 0, 0, 0, 0]: cv2.putText(img, "Punch", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2) elif fingers == [1, 1, 1, 1, 1]: cv2.putText(img, "Hi", (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
cvzone for the hand detection module.
OpenCV for the computer vision functionalities.