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
ht = handtrack.handDetector(maxHand=2, drawLandmark=True)
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)
while True:
success, img = cap.read()
img, hand = ht.findHands(img)
print(hand)
cv2.namedWindow("Hand Track", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("Hand Track",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
cv2.imshow("Hand Track", img)
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,...]