Show HN: Hand Gesture Control for PC – No Mouse Needed

3 months ago 5

This project allows you to control a computer using gestures recognized through the camera. To work with the project, Python 3 and prior installation of the required libraries are required.

Setting up the Environment

  1. Install Python 3 if it is not already installed on your computer.

  2. Clone the repository or download the project source code.

  3. Open a terminal or command prompt and navigate to the project folder.

  4. Install the required dependencies by running the following command:

pip install -r requirements.txt

To control the computer using gestures, follow these steps:

  1. Run the main project script:
python gesture_control.py

After running, the computer's camera will start recognizing gestures and translating them into control commands.

The following gestures are currently supported in pretrained model:

  1. No Action (Default)
  2. Cursor Control

Cursor Gesture

This gesture allows you to control the cursor movement on the screen.

  1. Left Click

Left Click Gesture

Perform this gesture to simulate a left mouse click.

  1. Right Click

Right Click Gesture

This gesture simulates a right mouse click.

  1. Scrolling

Scrolling Gesture

Use this gesture to scroll vertically on the screen.

Collecting a Dataset for Training

If you want to expand the functionality or improve the accuracy of gesture recognition, you can collect your own dataset:

  1. Modify the codes and names of gestures in the src\data_utils.py module as you see fit.

  2. Run the script to collect data:

  1. In the camera window that appears, perform the gestures you want to add to the dataset. To save the gesture data, press the "Space" key.

After collecting the dataset, you can train the model on the collected data:

  1. Run the model training script:
  1. In the train.py script, you can adjust the training hyperparameters. After training, the model will be saved to the gesture_model.pth file.

If you have any questions or issues with using the project, refer to the "Issues" section of the repository on GitHub.

Read Entire Article