/Control-things-with-hand-gesture

A small project I did while learning about Computer Vision. It enables hand gestures to control functions like light bulbs, computer speakers, mice, and fans using Python and Mediapipe. 🖐️💡🔊🖱️🌬️

Primary LanguagePythonCreative Commons Zero v1.0 UniversalCC0-1.0

OpenCV Hand Gesture Control Things

   

Linkedin Facebook Gmail

✅About

This is a personal project and the final project for the Computer Vision course at Van Lang University, which I worked on alone. The project is a software that has 4 functions that can be controlled by hand gestures: light bulb, computer speaker, computer mouse, and fan.

The project was written in Python language and uses Mediapipe to detect hand gestures.

Here are some important parameters of Mediapipe that we need to pay attention to:

max_num_hands: The maximum number of hands can be detected by the GestureRecognizer.
min_detection_confidence: The minimum confidence score for the hand detection to be considered successful.
min_tracking_confidence: The minimum confidence score for the hand tracking to be considered successful.

If you would like to learn more about this project, please refer to the following documents:

📌Requirements

Firstly, to ensure that the program can run smoothly, I recommend that you install these libraries before we begin.

And don’t forget that your computer needs a webcam to be able to use this program! 📷📷

pip install pillow 
pip install opencv-python 
pip install mediapipe 
pip install pycaw 
pip install comtypes 
pip install numpy 
pip install pyautogui

🛠️Installation

After you’ve installed the requirements, you can clone this repository or download it here to your local disk. Then, simply run the main.py file to enjoy the program experience. 🎉

📙How to use (Program Tutorial)

As you mentioned earlier above, this program includes 4 functions, and each function has a different usage.

REMEMBER: If you want escape the program, just simply press Esc on your keyboard.

💡Light Bulb Control (max_num_hands=1):

To control the light bulb function, you need to know that each light bulb corresponds to one of your fingers. When you raise a finger, the light bulb depends on it will turn on, and when you lower that finger, the light bulb will turn off.

Light Rule:

Finger Light color
Thumb Yellow🟨
Index Red 🟥
Middle Green 🟩
Ring Blue 🟦
Pinky Orange 🟧

📍Example:

🔊Volume Control (max_num_hands=2):

This function allows you to control the overall sound on your computer. By raising your thumb and index finger, you can increase or decrease the volume according to the distance you create between these two fingers. The farther apart your fingers are, the louder the volume will be, and vice versa. (This function can work on both hands)

📍Example:

🖱️Mouse Control (max_num_hands=1):

When you activate this function, a blue rectangle frame will appear on your webcam. This blue frame represents the resolution of the screen you are using. To control the mouse cursor, simply raise and move your index with middle finger in the frame. If you want to click the mouse, you can bend your index finger quickly at the position where you want to click. Just pretend you are clicking a real computer mouse. :]]

📍Example:

𖣘 Fan Control (max_num_hands=1):

For the fan control function, all you need to do is clench your hand to turn off the fan and open all 5 fingers to turn on the fan. (Note: All 5 fingers must be open for the fan to turn on!)

📍Example:

✍️Author:

Nobody except me! Haha😆😆

As mentioned earlier, this is a project that I worked on alone and learned from many sources on the internet, even using AI. So if you want to support me in developing and creating projects like this, please help me buy some milk 🐮 (I am really addicted to Millo).

📝References: