Git Product home page Git Product logo

kaykobad / ee241-project-airbrush Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 13.83 MB

In this project, we will build a virtual canvas where anyone can draw using a colored marker on hand. A virtual canvas with a white background will be created with the option to select colors and clear the canvas.

Home Page: https://portfolio.kaykobadreza.com/

Python 100.00%
image-processing opencv python

ee241-project-airbrush's Introduction

Airbrush: The Digital Finger Painting Experience

Environment

Python == 3.9.6
numpy == 1.24.2
opencv-contrib-python == 4.7.0.72

How to run the project:

  • Make sure your computer has a camera or connected to an external webcam
  • Install Python 3.9 or above on your computer
  • Open terminal and change the working directory to project directory
  • Install the required libraries by running pip install -r requirements.txt
  • Run the code by running python main.py

Things to note

  • The default target marker color is Blue. You can change the color by changing the target color range in the Target Color window.
  • Move the marker slowly or with decent speed. Do not move the marker too fast.
  • Press q to exit the program.

Problem statement:

In this project, we will build a virtual canvas where anyone can draw using a colored marker on hand. A virtual canvas with a white background will be created with the option to select colors and clear the canvas. We will use the camera to capture a live video stream, and then use the movement of our hand as a colored marker to draw on a virtual canvas. When we move the marker onto the predefined colors, the stroke color of the marker will be changed. If we put the marker on the "Clear All" option, the canvas will be cleared. Each frame on the stream will be converted into HSV color space and a mask will be generated. We will use morphological operations to preprocess the mask for detecting the marker correctly. The movement of the marker will be detected with a contour and the center point of the contour will be used to draw/put color on the canvas.

Proposed work:

Here is a more detailed step by step description of our proposed task:

  • Environment: We will need Python, OpenCV, and Numpy. These libraries will help us capture the live stream from the camera, convert the frames into the HSV color space, and perform various image processing operations to accomplish our goal.
  • Create a virtual canvas: Using OpenCV, we will create a white background as the virtual canvas. The size of the canvas will be based on the captured video stream.
  • Live stream and HSV color space: We will use OpenCV's VideoCapture class to start the camera feed and capture the live stream. We will convert each frame from the camera stream into the HSV color space. The HSV color space is more suitable for color-based image processing tasks, as it separates the hue, saturation, and value components of the image. This will help us remove noise, detect the marker movement easily.
  • Generate a mask: We will use some predefined HSV values to generate a mask. The mask will be used to detect the color of the marker. We will apply morphological operations, including dilation and erosion, to the mask to remove noise and improve the accuracy of the marker detection. This step will also help to remove small and unwanted regions from the mask.
  • Detecting the marker movement and drawing: We will find the contour of the marker in each frame to detect the movement of the marker. We will find the contours of the regions in the mask that correspond to the marker, and use the center point of the contour to draw on the virtual canvas.
  • Change color and clear the canvas: An option to clear the canvas and change color by detecting the marker placement over the "Clear All" and/or predefined color options. We can do this by checking the position of the marker and if it's over the "Clear All" option, we can set the virtual canvas to a white background or check if it is over any predefined color and change the stroke color accordingly.
  • Repeat the steps: You will repeat these steps continuously to draw on the virtual canvas in real-time as the marker moves. You will also need to check for the termination of the camera feed and handle it properly.

ee241-project-airbrush's People

Contributors

kaykobad 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.