Skip to content

Control Your Mouse with Mediapipe Handtracking in Python

Notifications You must be signed in to change notification settings

HanSolo15e/HandTrakingMouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Control Your Mouse with Mediapipe Handtracking in Python

Note: This implementation has only been tested on MacOS and may not work on Windows/Linux systems.

How to use

  • Put your hand infront of your Webcam

  • To perform a left click, tap your thumb and index finger while keeping your middle finger pointing up.

  • For a right click, tap your thumb and middle finger while keeping your index finger pointing up.

Requirements

  • Python 3.11 (This version is required by Mediapipe)

  • OpenCV for Python 3.11

  • PyAutoGUI for Python 3.11

Settings

If the project fails to launch or launches with the wrong webcam, you may need to adjust the following value in Main_HandTracking.py:

# Opens the webcam; input 1 is not always the webcam. If it is not, the project will not launch.
# You might need to play with the value to find your desired webcam.
cap = cv2.VideoCapture(1)

To change the sensitivity of the mouse, modify the multiplication factor for mouse speed:

# Mouse Sensitivity
X_multi = 1.5
Y_multi = 1.5

Limit the number of hands that can be traked at one time:

# set how manny hands it can detect at one time
# (More hands can somewhat effect performance)
Num_of_hands = 1

Adjust these settings as necessary to optimize the performance of the hand tracking and mouse control functionality.

About

Control Your Mouse with Mediapipe Handtracking in Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages