Git Product home page Git Product logo

virtual-painter's Introduction

Virtual Painter App

This Python application allows you to draw on a canvas by tracking your hand gestures in real time using OpenCV and the MediaPipe Hands library. You can select different colors and brush sizes using your fingers, as well as clear the canvas and undo the last stroke.

Table of Contents

Motivation

The purpose of this project is to demonstrate how to use computer vision techniques to create an interactive drawing experience that doesn't require any hardware beyond a standard computer and webcam. This project showcases the capabilities of the MediaPipe Hands library for hand detection and gesture recognition, and demonstrates how to integrate it with OpenCV for real-time visual feedback.

Prerequisites

This project requires Python 3.x and the following libraries:

  • OpenCV
  • NumPy
  • MediaPipe

You can install these libraries using pip:

!pip install opencv-python numpy mediapipe

Usage

To run the application, simply run the main.py script:

!python VirualPainter.py

This will open a new window showing the live camera feed with the drawing app overlayed on top.

Features

The following features are available in the app:

  • Brush size: Adjust the brush size by spreading or closing your index and middle fingers.
  • Color selection: Select a color by extending your thumb and selecting one of four colors displayed at the top of the screen.
  • Undo: Undo the last stroke by making a fist.
  • Clear canvas: Clear the entire canvas by extending all fingers.

Implementation Details

The application uses the MediaPipe Hands library to detect hand landmarks and recognize hand gestures. For each frame of video captured by the webcam, the landmarks are detected and analyzed to determine which gestures the user is making. The application then responds to these gestures by updating the state of the drawing canvas and overlaying it on top of the live video feed.

The drawing canvas itself is implemented using OpenCV, with each stroke added to a separate image that is merged with the live video feed when displayed on screen. Brush size and color selection are also handled using OpenCV functions for drawing shapes and filling regions of an image.

Sample Runs

image image

virtual-painter's People

Contributors

mohamedmamdouh18 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.