-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d7a8d2
commit 67f1679
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# HandTrackingModule | ||
This is a simplified version of mediapipe to do hand tracking | ||
|
||
Here is the example code to run the file: | ||
|
||
import cv2 | ||
from handtrackingmodule import FindHands | ||
|
||
cap = cv2.VideoCapture(0) | ||
detector = FindHands() | ||
|
||
while True: | ||
succeed, img = cap.read() | ||
hand1_positions = detector.getPosition(img, range(21), draw=False) | ||
hand2_positions = detector.getPosition(img, range(21), hand_no=1, draw=False) | ||
for pos in hand1_positions: | ||
cv2.circle(img, pos, 5, (0,255,0), cv2.FILLED) | ||
for pos in hand2_positions: | ||
cv2.circle(img, pos, 5, (255,0,0), cv2.FILLED) | ||
print("Index finger up:", detector.index_finger_up(img)) | ||
print("Middle finger up:", detector.middle_finger_up(img)) | ||
print("Ring finger up:", detector.ring_finger_up(img)) | ||
print("Little finger up:", detector.little_finger_up(img)) | ||
cv2.imshow("Image", img) | ||
if cv2.waitKey(10) == ord('q'): | ||
break | ||
|