Skip to content

Repository files navigation

AI Virtual Mouse & Keyboard (Hybrid Python/C++)

A gesture-controlled computer vision application built as a Object-Oriented Programming (OOP) project. This software serves as a hardware-free backup utility, allowing users to control system navigation and input commands through a laptop webcam.

Key Features

  • Computer Vision Tracking: Processes real-time webcam frames to track hand gestures for seamless mouse cursor movement and click events.
  • Hybrid System Logic: Bridges Python vision pipelines with C++ to inject system-wide numeric commands (0-9) across any active text editor software.
  • OOP Architecture: Designed with highly modular Python classes to encapsulate gesture tracking data using strict inheritance patterns.

How to Run Locally

Because this project uses a hybrid architecture, you must run the Python tracking module and the C++ system command listener in two separate terminal windows simultaneously.

Terminal 1: Start the Python Tracking Module

  1. Navigate into the project folder.

  2. Install core dependencies:

    pip install opencv-python mediapipe

  3. Execute the core computer vision tracking script:

    python PYTHON_Main_Body.py

Terminal 2: Create and Run the C++ Key Listener

  1. Open a brand-new terminal tab or window.

  2. Navigate into the same project folder.

  3. Step 1: Create the Executable File Run the compilation command below to generate your own executable application from the C++ source files. You can change YourCustomName.exe` to any name you prefer for your program file:

    g++ CPP_Main_Body.cpp Keyboard_KeyReceiver.cpp -o YourCustomName.exe -lws2_32

  4. Step 2: Verify File Creation
    Check your local project folder directory. You will see that a brand-new, compiled binary file matching your chosen name (e.g., YourCustomName.exe) has been successfully created.

  5. Step 3: Run the Created Executable
    Execute the generated program file to start the system-wide key listener:

    .\YourCustomName.exe

Windows Firewall

During the first execution of .exe file, Windows may display a Windows Security Alert.

If prompted:

  1. Allow access for the application.
  2. Enable Private networks.
  3. Click Allow access.

User Guidance For using Gestures

This section explains how to use the AI Virtual Mouse & Keyboard through hand gestures. Make sure your webcam is active and keep your hand clearly visible inside the camera frame.

Toggle Between Mouse And Keyboard

While using the Virtual Mouse and Keyboard you can use you can use one at a time so toggling between Mouse and Keyboard use this gesture:

Gesture: Cross the wrists of your both arms.

Action: Toggling Between Mouse and Keyboard

Image: Control Switching


Mouse Controls

Use your right hand for mouse operations.

Mouse Movement

Gesture: Raise your index and middle fingers while keeping your thumb straight.

Action: Move your hand in the desired direction to control the mouse cursor.

Image: Cursor Motion


Stop Mouse Movement

Gesture: Keep your index and middle fingers up and close your thumb.

Action: Stops the cursor from following your hand.


Left Click

Gesture: Keep your middle finger up, bend your index finger, and close your thumb. Keep the remaining fingers down.

Action: Performs a left mouse click.

Image: Left Click


Right Click

Gesture: Keep your index finger up and put your middle finger down, and close your thumb. Keep the remaining fingers down.

Action: Performs a right mouse click.

Image: Right Click


Double Click

Gesture: Keep both your index and middle fingers down, and close your thumb. Keep the remaining fingers down.

Action: Performs a double left click.


Keyboard Controls

The keyboard mode allows you to type numbers from 0–9 and use Backspace through hand gestures you can type on any application that allow to write text as What's App, MS word, Notepad etc.

Use the hand positions shown below to generate the corresponding keyboard input.

Type 0

Action: Types the number 0.

Image: Typing 0


Type 1

Action: Types the number 1.

Image: Typing 1


Type 2

Action: Types the number 2.

Image: Typing 2


Type 3

Action: Types the number 3.

Image: Typing 3


Type 4

Action: Types the number 4.

Image: Typing 4


Type 5

Action: Types the number 5.

Image: Typing 5


Type 6

Action: Types the number 6.

Image: Typing 6


Type 7

Action: Types the number 7.

Image: Typing 7


Type 8

Action: Types the number 8.

Image: Typing 8


Type 9

Action: Types the number 9.

Image: Typing 9


Backspace

Action: Deletes the previous character using the Backspace key.

Image: Backspace

About

A gesture-controlled AI virtual mouse and keyboard utility built with a hybrid Python/C++ object-oriented architecture.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages