Skip to content

πŸ‘ HandTrackingProject is a Python script for hand tracking using MediaPipe and OpenCV. It enables real-time hand detection and tracking in a webcam feed, providing visualizations of hand landmarks and connections.

License

Notifications You must be signed in to change notification settings

PetrovEvgeniy/HandTrackingProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘ HandTracking using MediaPipe and OpenCV

This repository contains a Python script for hand tracking using MediaPipe and OpenCV. It utilizes the MediaPipe library to detect and track hands in a live webcam feed, drawing landmarks and connections on the detected hands.

πŸ› οΈ Requirements

  • Python 3.x 🐍
  • OpenCV (cv2) πŸ“·
  • MediaPipe (mediapipe) πŸŽ₯

⬇️ Installation

To install the required libraries, run the following command:

pip install opencv-python mediapipe

πŸš€ Usage

  1. Clone this repository or download the HandTracking.py script.

  2. Run the script using the following command:

python HandTracking.py
  1. Once the script is running, it will open your webcam feed and start detecting and tracking your hands.

  2. You'll see landmarks and connections drawn on your hands in real-time.

  3. Press the 'Esc' key to exit the program.

✨ Features

  • Detects and tracks multiple hands in a webcam feed.
  • Draws landmarks and connections on the detected hands for visualization.
  • Calculates and displays the frame rate (FPS) of the webcam feed.

🀏 Examples

  • HandGestureImageHolder.py script showcases an example of how to display a custom image on the screen and it gives the illusion that you are holding an image with just your three fingers (thumb,index and middle). The picture will move along the screen as long as you are maintaining this specific (Italian) gesture

πŸ”§ Customization

You can import the HandTrackingModule.py script and customize the behavior of the hand detector by modifying the parameters in the handDetector class constructor of the script. Here are some parameters you can adjust:

  • mode: Set to True if using static images (default is False for webcam feed).
  • maxHands: Maximum number of hands to detect (default is 2).
  • detectionCon: Minimum confidence threshold for hand detection (default is 0.5).
  • trackCon: Minimum confidence threshold for hand tracking (default is 0.5).

You can also modify the drawing specifications (e.g., colors, thickness) by editing the findHands() and findPosition() methods in the handDetector class.

πŸ™ Credits

This script utilizes the following libraries:

  • OpenCV - Open Source Computer Vision Library
  • MediaPipe - A cross-platform framework for building multimodal applied ML pipelines

Special thanks to Murtaza's Workshop - Robotics and AI for their valuable tutorials and resources in the field of Robotics and AI.

License πŸ“

This project is licensed under the MIT License - see the LICENSE file for details.

About

πŸ‘ HandTrackingProject is a Python script for hand tracking using MediaPipe and OpenCV. It enables real-time hand detection and tracking in a webcam feed, providing visualizations of hand landmarks and connections.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages