This project lets you shut down your computer using a hand gesture detected via your webcam. Built with Python, OpenCV, and MediaPipe, it identifies a specific gesture (middle finger up, others folded) and executes an immediate shutdown.
Install the required Python packages using:
pip install -r requirements.txtThe requirements.txt file contains:
opencv-python
mediapipe
numpy
- Captures real-time hand landmarks using MediaPipe.
- Detects if:
- Middle finger is extended.
- Index, Ring, and Pinky fingers are folded.
- If the gesture matches, triggers a system shutdown.
βοΈ Warning: Shutdown is immediate once the gesture is recognized. Test carefully!
- Clone the repository and navigate into the project folder.
- (Optional but recommended) Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows- Install the dependencies:
pip install -r requirements.txt- Run the script:
python main.py
or
python3 main.py- Allow webcam access.
- Make the ultimate savage gesture:
- Raise your middle finger high like you're flipping off your PC βοΈ.
- Keep the rest of your fingers tucked down like they know who's boss.
- Watch your computer surrender and shut down immediately.
- Press
Qif you want to exit like a "civilized" human without nuking your machine.
- To test without shutting down, comment
shut_down_computer()and uncommentprint("shutdown"). - Landmark detection follows MediaPipe's index for hand joints.
-
Image Flip:
- Makes webcam act like a mirror.
-
Y-Axis for Detection:
- In MediaPipe,
yincreases downward. - If fingertip
yis higher (smaller) than the PIP jointy, the finger is pointing upward.
- In MediaPipe,
"Left
# print("shutdown")commented out... because I'm cool like that. π"
Stay savage. π
GPL-3.0