February 23, 2020

Don’t Miss this Python Project – Mouse Control With Hand Gestures.

Mouse Control With Hand Gestures.

Hey there, welcome back guys, we are back with another interesting Python project with source code – Mouse control with hand gestures using Python for you. Thanks for showing lots of love for the Fake News Classifier with the NLP project.

Get $100/hour To Use Facebook, Twitter, And Youtube | Learn More

The title sounds cool, right? It would be so cool to control your mouse with your hand gestures. Image using your mouse pointer without touching the mouse.

Someone might think you as a magician you can look cool in front of your friends. This is possible by using some image processing concepts, computer vision, and Python. This is my most famous Python project in Github which gained popularity with 5 stars and 5 forks. Here is the link to the project.

Demonstration of Python Project With Source Code

Watch the demonstration of this Python project on GitHub. Take a look at the consequence of the project if you find it cool you can develop it for yourself.

Python project github
Mouse control with hand gestures.

Work Flow of the project –

The philosophy behind this project is as follows –

  • We specify the color range of interest i.e. the color of the glove.
  • Using the color range we filter only objects having that color code.
  • Next, we select the region of interest. The region with the maximum area in our feed. (This region of interest lies in the color range).
  • Now, we associate the mouse controls with the movements of our ROI ( Region of interest, hand in this case).

Also, Check – Customer Churn Prediction using Machine Learning 2023 | MOST POPULAR PYTHON PROJECT

Steps to run this Python project

  1. Prerequisite( Ignore if you have Python) – As a prerequisite, you need Python installed in your system. Download the compatible version of Python from here.
  2. Run the following commands in the terminal or cmd-
git clone https://github.com/globefire/Hand_detection_tracking_opencv
cd Hand_detection_tracking_opencv-
pip install -r requirements.txt 
python hand_detection_tracking.py

Note from the developer(Nitin Sahu): When your palm is open you can move the mouse with your hand gestures. When you form a fist a left click is performed.

MUST-READ: Hands-on Exploratory Data Analysis Python Code & Steps -2023 | MOST POPULAR PYTHON PROJECT

Libraries used for this interesting Python project

This project uses opencv_python, NumPy, and input libraries. Here is an overview of these libraries.

  1. opencv_python – This free open-source library developed by Intel is used to capture the feed. The feed is very important in the project, you will also need a webcam installed. You can implement the project without a webcam too. You need to install the IP Webcam. Comment down in this article for a detailed explanation.
  2. NumPy – We use this powerful mathematical library to define kernels. These kernels are essential to filter the region of interest. NumPy is also used to maintain the color range of interest.
  3. PyInput – This is the cherry on the cake here. We use this library to perform mouse pointer operations like moving it and performing clicks.

Let’s see the explanation of the code now.

Will You Be Rich & Famous ? Click Here to Find Out in 60 Seconds | Click Here

Walkthrough of Python Code –

  1. Importing Python modules and creating necessary instances.
Mouse control with hand gestures using python
Image 1/3

We need to create instances of the modules imported to use them. The explanation of instances like kernel Open, and kernel Close is mentioned in the script.

2. Capture feed and filter it

python project with source code
Image 2/3

Here we detect only regions within the color range of our interest. Then we remove the noises from this region by applying morphology.

Select the region with the maximum area as our controller.

3. Perform mouse operations

python mini project github
Image 3/3

After filtering the region of interest, we decide when to move the mouse pointer and when to perform a click.

If the area of our control(our palm) lies in an integer range we consider it as an open palm. Otherwise, we consider it a first.

MUST READ – How to Get a Coding Job with No Experience [Updated]

Concluding – Mouse control with hand gestures

I will now conclude the article. Always remember you’ve got an idea. Python a sturdy tool will help you achieve that idea.

I had many ideas and bringing them into real-life Python has helped me a lot. I have many interesting Python projects for beginners in Github that are developed to solve my daily life predicaments.

Thank you for reading this article. If you savored the idea behind this article if you found this article effective do share a word on Facebook, Instagram, or LinkedIn.

Also, we would appreciate it if you leave a star on the GitHub repository it drives people like me to contribute more in the open-source world.

Do read my previous article on how to make a live color detector with Python, and how to build an audiobook generator with Python.

Give your opinions about this Mouse control with hand gestures in Python in the comment section.

Also If you have queries regarding this interesting Python mini-project, you can write it down in the comment section below. To know more about such topics go through My Blind Bird.

You can check out our other projects with source code below-

  1. Fake News Classifier with NLP 2023
  2. Spam Email Detection Using Machine Learning Projects for Beginners in Python (2023)
  3. Hands-on Exploratory Data Analysis Python Code & Steps -2023
  4. Best (2023) Python Project with Source Code
  5. Live Color Detector (#1 ) in Python 2023
  6. Wondering Why Is Coding So Hard? Read This Article

Feel free to contact us! Happy Coding!

Mini Projects