Skip to content

Tusm11/Finger-Counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Hand Finger Counter

A real-time AI-powered hand finger counter using Python, OpenCV, and MediaPipe. This project detects hands through a webcam and counts the number of fingers held up in real-time.

Features

  • Real-time Detection: High-speed hand tracking using MediaPipe.
  • Dual Hand Support: Counts fingers from both hands simultaneously.
  • Robust Logic:
    • Uses distance-based logic for Thumb detection.
    • Uses Y-coordinate comparison for the other four fingers.
  • Sleek UI: Displays the total count in a styled overlay on the video feed.

Visuals

The application displays a live feed with:

  1. Hand landmarks and skeletal connections.
  2. An overlay box showing the total count of fingers currently visible.

Installation

Prerequisites

  • Python 3.8+
  • Webcam

Setup

  1. Clone the repository:

    git clone https://github.com/Tusm11/Finger-Counter.git
  2. Install dependencies:

    pip install opencv-python mediapipe
  3. Run the application:

    python main.py

Controls

  • Press any key: Closes the application.

How it Works

  1. Hand Tracking: MediaPipe identifies 21 key landmarks for each hand.
  2. Thumb Detection: Calculates the Euclidean distance between the thumb tip and the index base. If the distance exceeds a threshold, the thumb is considered "open".
  3. Finger Detection: Compares the Y-coordinate of each finger's tip with its middle joint. If the tip is higher (lower Y-value in image coordinates), the finger is considered "open".
  4. Summation: Adds up all "open" fingers across all detected hands.

About

AI-powered real-time finger detection and counting system using Computer Vision.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages