Awesome OpenCV + Mediapipe project to change the volume/screen brightness, scroll, and control the mouse pointer - all with gestures!
Special thanks to Vinamra bhaiya for the foundation!
To download the Application Click Here
Run the project.exe file (iron man logo), and you're good to go :)
It is recommended that you run main.py directly from src, because the executable's performance is notably slow.
- Mouse Control with Right Hand
- Scroll with Right Hand
- Brightness Control with Left Hand
- Volume Control with Right Hand
- Alt + Tab Simulation with Left Hand
For Windows - (Tested with Python 3.9.5)
After cloning the repo, run these commands in command prompt
Install the virtual environments package
pip install virtualenv
Create a virtual environment with the name venv
virtualenv venv
Activate the created virtual environment (use one of the two commands)
.\venv\Scripts\activate.bat
.\venv\Scripts\activate.ps1
Install the required packages
pip install -r requirements.txt
If you are using VSCode, configure settings.json as follows
{
"python.pythonPath": ".\\venv\\Scripts\\python"
}
(Create separate file for this section)
-
Webcam
If the webcam doesn't work, pass 1 instead of 0 in the lines using cv2.VideoCapture() as follows:capture = cv2.VideoCapture(1)
- Mediapipe's Left Hand / Right Hand Classifier is not always accurate, which might lead to some incoherence
First install auto-py-to-exe with
pip install auto-py-to-exe
If you get the error - module enum has no attribute IntFlag, uninstall auto-py-to-exe, then enum34 and reinstall the former
pip uninstall auto-py-to-exe
pip uninstall enum34
pip install auto-py-to-exe
Now run auto-py-to-exe with
pip install auto-py-to-exe.exe
Merge the code into a single file called project.py Locate project.py in auto-py-to-exe In the settings, choose
- One Directory
- Window Based (hide the console)
Choose the icon from the images folder (or use your own!)
In the 'Advanced Menu', go to paths, and paste the path to your Scripts folder present in venv
Note!
After compilation copy files from "venv\Lib\site-packages\mediapipe"
into "output\mediapipe" present in the created project folder
This needs to be done because Mediapipe's files do not get automatically added.