Skip to content

A software that will allow you to perform basic mouse operations by using certain hand gestures and movements in front of your webcam.

Notifications You must be signed in to change notification settings

Mr00Magician/Virtual-Mouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VIRTUAL MOUSE

Made with ❤️ and by Mr00Magician


FAST FORWARD

TECH STACK

icons8-opencv-48
OpenCV Mediapipe Pillow Python

ABOUT THE APP

Developed using OpenCV and Mediapipe, this app will allow you to use your computer without a physical mouse by allowing you to perform basic mouse operations by using certain hand gestures and movements in front of your webcam. If you wish to have better FPS while using this app, use the CUI based version

HOW TO RUN

To run this app, you can download the latest release where you will find a .exe file. Run the .exe file and that's it! However if you wish to use the source code to run the app, follow these simple steps:

  • See that you have Python installed.
  • Clone this branch (or the repository if you wish to).
  • Create a new Python environment and install the dependencies in it. This can be done as follows:
    • Open command prompt and cd to the directory where you have cloned the repo.
    • Run the command Python -m venv env to create a new virtual environment named env
    • Activate the enviroment by running the command env\Scripts\activate.bat
    • Install depencies by running the command pip install -r requirements.txt

The above steps will create a python virtual environment and install the required depndencies in it. Now whenever you want to run the app, follow these steps:

  • Open command prompt and cd to the directory where you have cloned the repo.
  • Activate the python environment by running the command env\Scripts\activate.bat.
  • Run the app by the command Python GUI_Virtual_Mouse.py.

INSTRUCTIONS ON HOW TO USE THE APP

Upon running the app, your webcam will be turned on and will be used to track your hand and fingers. By default, this app assumes that the distance between your hand and your webcam is about 20cm. This can be changed by using the options menu to change the webcam distance as per your preference. As of now, you can only use your right hand to use this app. Support for left hand is coming soon. This app works in 4 modes:

  • Pointer Mode
  • Left Click Mode
  • Right Click Mode
  • Scrolling Mode

Pointer Mode

This mode will be triggered when only your index finger is up, while the rest are down. In this mode you can move around your index finger to move the cursor on screen. The red circle on the index finger indicates that you are in pointer mode.

Left Click Mode

This mode will be triggered when your index and middle fingers are up while rest are down. While in this mode, bring your index and middle fingers closer to perform a typical mouse left-click. The red circle on the index and the middle finger indicates that you are in left-click mode.

Right Click Mode

This mode will be triggered when your index finger and thumb are up while rest of the fingers are down. While in this mode, bring your index finger and thumb closer to perform a typical mouse right-click. The red circle on the index finger and the thumb indicates that you are in right-click mode.

Scrolling Mode

This mode will be triggered when your index, ring and middle fingers are up while rest of the fingers are down. While in this mode, move your ring finger away from your middle finger to scroll up and move your index finger away from your middle finger to scroll down. The red circle on the index, ring and the middle finger indicates that you are in scrolling-click mode.

See Screenshots for better understanding of different modes. If this app does not work properly for you, customising it may remove any the problems that you face.

CUSTOMISATION

You can customise some aspects of this app based on your preferences by using the options menu that appears on the top left corner of the window upon running the app. Few of the things you can change are:

  • Assumed distance between your hand and your webcam (This setting will greatly influence how effective your clicks are registered).
  • Sensitivity of the cursor
  • Amount of smoothening applied to movement of cursor
  • Enable/Disbale FPS

SCREENSHOTS

Hand Detection
Hand Detection
Pointer Mode
Pointer Mode
Left Click Mode
Left Click Mode
Left Click Triggered
Bring fingers closer to trigger mouse left-click. The circle between the fingers will turn green when a click is triggered
Right Click Mode
Right Click Mode
Right Click Triggered
Bring index finger and thumb closer to trigger mouse right-click. The circle between them will turn green when a click is triggered
Scrolling Mode
Scrolling Mode
Scroll Up
Scroll up by moving your ring finger away from Middle finger
Scroll Down
Scroll Down by moving your index finger away from your middle finger

A GIF TO DEMONSTRATE WORKING

Demo GIF

NOTE

Sometimes the position of thumb is such that its hard to detect whether it is up or down as it doesn't actually go down like rest of the fingers. This may cause issues. So keep in mind that the correct position of thumb when it will be treated as up or down or not active is as follows:

Thumb Up
Thumb Up
Thumb Down
Thumb Down

About

A software that will allow you to perform basic mouse operations by using certain hand gestures and movements in front of your webcam.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages