Skip to main content

Pre-built OpenCV-Python/Mediapipe modules that easy to use and understand.

Project description

pygesture

Pre-built OpenCV-Python/Mediapipe modules that easy to use and understand.
For now it only had Hand Track. More features will be add in future.

Table of Contents

Installation

pip install pygesture
  • First time use might won't work, so try it again.
  • Because it need to generate it own __pycache___.

Hand Track

  • Hand tracking technology with the help of Mediapipe.
  • This also detect if it Left or Right Hand.
  • I know there a lot of stuff down there but trust me.
  • Just read it one by one it easy to understand.
from pygesture import handtrack
import cv2

# [int] maxHand: The maximum amount hand that allowed to be track.
# [bool] drawLandmark: Draw on landmark and connect them together.
# You can also put nothing in there it will also work.
# Ex: handtrack.handDetector()
# There are more options available, you can check the source code if want to learn more.
ht = handtrack.handDetector(maxHand=2, drawLandmark=True)
cap = cv2.VideoCapture(0)

# This is a config for camera resolution.
# But the quality still limit by your camera.
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)

while True:
    success, img = cap.read()
    
    # The value will return everything you need.
    # img: is the image result.
    # hand: is the value of left or right hand and value of each landmarks on each hand.
    img, hand = ht.findHands(img)
    
    # Print it out to see what going on. 
    # This will return None if no hand detect. Make sure to add a check condition.
    print(hand)
    
    # "Hand Track" you can name it whatever you want. But other options may required.
    cv2.namedWindow("Hand Track", cv2.WND_PROP_FULLSCREEN)
    
    # [Optional] You can use this if you want full screen.
    cv2.setWindowProperty("Hand Track",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
    
    # Display output image.
    cv2.imshow("Hand Track", img)
    
    # Wait in milliseconds before capture next frame.
    cv2.waitKey(1)
  • You can also try the pre-built test
from pygesture import handtrack_test

Hand Vector

Landmarks Coordinate

  • Even though there no landmarks number specify.
'lms': [
        x: 0.2995750904083252
        y: 0.7221927642822266
        z: -4.386473335671326e-07,

        x: 1.2995750904083252
        y: 4.7221927642822266
        z: -4.626473335671326e-07,

        .....
    ]
  • Each index inside a list is the landmark it self. Start from [0,1,2,...]

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

pygesture-1.0.4.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygesture-1.0.4-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file pygesture-1.0.4.tar.gz.

File metadata

  • Download URL: pygesture-1.0.4.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for pygesture-1.0.4.tar.gz
Algorithm Hash digest
SHA256 4f34db46dd634af4bf3bd69c591c78f364667c092f39521eac2dde40c248b9bc
MD5 51c267a4be9e0f12176dfc6567521844
BLAKE2b-256 b6276f38bfc12e4a5ae02175ee4cf4b94c83bbb81de76cbcef03d0e04583bb59

See more details on using hashes here.

File details

Details for the file pygesture-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: pygesture-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for pygesture-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ced71337ca2db799773032afef3b9bb10635e6c13e1cb3e40a26dd6daaf7a55e
MD5 5329e6fc3e7b4abc166d02d1a473e488
BLAKE2b-256 688bcc959d4ae8f173b547a6691101c3c618cfb16242ada60c4877d1380dde77

See more details on using hashes here.

Supported by

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