Skip to main content

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.
  • Required assets.zip
  • Just Extract it in the same directory as your script.
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,...]

Metadata

Release files for pygesture 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygesture 1.0.7
File Size Uploaded
pygesture-1.0.7.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygesture 1.0.7
File Interpreter ABI Platform
pygesture-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 21.1 kB

Release files / pygesture-1.0.7.tar.gz

Download URL pygesture-1.0.7.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1fe15fdfc7b85ae8e639fdca873c4c65c93ae461b88a62f4424460ad9d995964
BLAKE2b-256 checksum
How to use checksums
7b66203ce0e5887ddeb9e7c0a27e816235f443ee1ef248d477014b484212ac49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / pygesture-1.0.7-py3-none-any.whl

Download URL pygesture-1.0.7-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bc6c99f4904e15f476cc2957ddfb814a4ad8964441d25b345dd0b91ae4061c8
BLAKE2b-256 checksum
How to use checksums
cb2eec7cea14ecfeb0742b1ef20da72cecc57276036e3c0034c47fc73d078560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page