Skip to content

Create Handtracking #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Handtracking
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#import the libraries
import cv2
import mediapipe as mp
mp_drawing=mp.solutions.drawing_utils
mp_drawing_styles=mp.solutions.drawing_styles
mphands=mp.solutions.hands

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the structure of the repository: Repository > Sub-Repository (for your project) > your code.

I also see that the file doesn't have an extension. Please make it a python file.

cap=cv2.VideoCapture(0)
hands=mphands.Hands()
while True:
data,image=cap.read()
image=cv2.cvtColor(cv2.flip(image,1),cv2.COLOR_BGR2RGB)
results=hands.process(image)
image=cv2.cvtColor(image,cv2.COLOR_RGB2BGR)
if results.multi_hand_landmarks:
for hand_landmarks in results.multi_hand_landmarks:
mp_drawing.draw_landmarks(
image,
hand_landmarks,mphands.HAND_CONNECTIONS)
cv2.imshow("Handtracker",image)
cv2.waitkey(1)