Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 3.05 KB

README.md

File metadata and controls

64 lines (43 loc) · 3.05 KB

Virtual-Mouse

Virtual-Mouse is a mouse that brings functionalities of a regular mouse to your PC camera. It brings the convenience of moving cursor and clicking functionalities just by showing hand gestures to your camera.

You need a camera/webcam set up with your PC.

How to use?

Very simple. Just download or clone the repository and install the following Python modules and your are good to go! Simply run the program and it will pop up a window showing the camera. Show up your hand, you will notice 2 circles in 2 dedicated fingers Thumb & Index Finger in the camera view.

Q: How can I move my mouse cursor?

A: It's Simple! Just move your Index Finger to move your cursor!

Q: How can I click to a button or on something?

A: It's also really simple! All you need to touch your Index Finger with your Thumb or just need to make the distance between Index and Thumb Fingers minimum 20 pixels!

Tip: You can also change the minimum distance by changing 20 here:

if abs(index_y - thumb_y) <= 20:

Names of Fingers

Names of Fingers

Software Requirements

Module Requirements

Module Version pip Command
msvc-runtime 14.29.30133 pip install msvc-runtime==14.29.30133
opencv-python 4.6.0.66 pip install opencv-python==4.6.0.66
mediapipe 0.8.10 pip install mediapipe==0.8.10
PyAutoGUI 0.9.53 pip install pyautogui==0.9.53

Problems

Some predicted Problems with Solutions mentioned down there!

Mediapipe

Error:

ImportError: DLL load failed while importing _framework_bindings: The specified module could not be found.

Solve:

For the module msvc-runtime this error should be fixed. If it not, please install Microsoft Visual C++. If you have that in your PC, please consider installing the updated Microsoft Visual C++. If you get that error after installing, please Restart your PC!

opencv-python(cv2)

Error:

ConnectionAbortedError: cv2: No Camera Found!

Solve:

This error occurs, when the program can't find your Camera. It usually appears when you use more than one camera! You have to specify a single camera by changing the camera number here:

cap = cv2.VideoCapture(0)
I used 0 here because there is a single camera in my PC! You can try changing it to 1 or 2!