Skip to content

Latest commit

 

History

History
107 lines (69 loc) · 3.07 KB

README.md

File metadata and controls

107 lines (69 loc) · 3.07 KB

Gesture-Based Control System

This project allows users to control keyboard actions using color-based gestures captured through a webcam. The system detects specific colors in the video feed and triggers corresponding key presses.

Table of Contents

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Python 3.x installed on your system.
  • pip for managing Python packages.

##Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/gesture-control.git
    cd gesture-control
  2. Create and activate a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate   # On Windows use `venv\Scripts\activate`
  3. Install the required packages:

    Install the necessary Python packages using pip:

    pip install opencv-python imutils numpy pynput
    • opencv-python: For capturing and processing video feed.
    • imutils: For easier OpenCV usage.
    • numpy: For numerical operations.
    • pynput: For controlling the keyboard programmatically.

Usage

  1. Run the code:

    Ensure your webcam is connected and accessible. Run the tutorial.py file to start the gesture recognition system:

    python tutorial.py
  2. Control the system:

    The system will display a window showing the webcam feed. It recognizes color-based gestures:

    • LEFT: Move the object to the left side of the screen to trigger the 'A' key.
    • RIGHT: Move the object to the right side of the screen to trigger the 'D' key.
    • NITRO: Move the object to the bottom center to trigger the 'Space' key.
  3. Exit the program:

    Press the q key to quit the program.

Customization

To modify the color range detected by the system, you can adjust the colourLower and colourUpper variables in the script. These define the HSV color ranges for the object being tracked.

Example:

colourLower = np.array([94, 138, 115])
colourUpper = np.array([180, 255, 255])

Change the values to suit your desired color range.

Files

  • tutorial.py: Main script that runs the gesture detection and keyboard control.
  • color.py: Utility file for color detection (ensure this is correctly referenced in the main script).

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -m 'Add some feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.


You can copy this code and save it as `README.md` in the root directory of your project. This will automatically be recognized by GitHub when you push your project repository online.