Skip to main content

Handstar using Mediapipe and OpenCV Making Handdetection Easy

Project description

HandStar

HandStar is a Python library that uses Mediapipe and OpenCV to make hand detection and tracking easy. It provides functionalities to detect hands in real-time from camera feed, visualize hand landmarks, and calculate distances between specific landmarks.

Features

  • Real-time hand detection and tracking.
  • Visualization of hand landmarks and connections.
  • Calculation of distances between specified landmarks (e.g., fingertips).

Installation

You can install HandStar using pip:

pip install hand-star

Code

import cv2
from hand_star.hand_star import HandStar

def main():
    cap = cv2.VideoCapture(0)
    detector = HandStar(maxHands=2)

    while True:
        success, img = cap.read()
        if not success:
            break
        
        img = detector.detect_hands(img)
        lmList = detector.get_hand_positions(img)
        
        # Additional functionalities
        fingersList = detector.get_fingers_status()
        for i, fingers in enumerate(fingersList):
           print(f"Hand {i+1}:", fingers)
            length, img, lineInfo = detector.calculate_distance(4, 8, img, handNo=i)
            print(f"Hand {i+1} Distance:", length)
        
        cv2.imshow('Hand Detection', img)
        
        if cv2.waitKey(1) == ord('q'):
            break

    cap.release()
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main()

Contact

For any questions or feedback, feel free to reach out at sumitsingh9441@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hand_star-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file hand_star-1.0.0.tar.gz.

File metadata

  • Download URL: hand_star-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for hand_star-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5efc22cdf9e8c9fb576e57479288d0d50262ada52be5324105786481f04839ab
MD5 3bc41d8a2b1cbc80b3ca865bfe7b956d
BLAKE2b-256 e8ec5c76d65266aebf9db16b6c77ce8e3f0f58448700f8b1407da774d724f819

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page