Virtual Painter is a python based interactive application that utilizes computer vision techniques to detect the color of a marker held by the user. With the help of OpenCV, it allows real-time drawing on a webcam feed using the detected marker color.
-
Custom Marker Color Selection: The colorPicker module enables users to select their desired marker color by adjusting the HSV (Hue, Saturation, Value) values using intuitive trackbars.
-
Real-time Drawing: Once the marker color is selected, the virtualPainter module continuously analyzes the webcam feed. It tracks the movement of the marker and renders colored circles on the screen in real-time.
-
Clone the repository
git clone https://github.com/Hafsa-Malik/Virtual-Painter--OpenCV.git
or directly download zip file. -
Make sure you have OpenCV installed in main directory. If not cd to main directory and install
pip install opencv-python
-
Run the
colorPicker.py
script to select the marker color HSV values:python colorPicker.py
. Hold the marker infront of webcam and adjust trackbars until only the desired color is visible on the binary mask. Copy the HSV values and add them tomyColors
list as a new sub-list. Also add the corresponding BGR color which will be rendered on the canvas when these HSV values are detected inmyColorValues
. -
Run the
virtualpainter.py
script:python virtualPainter.py
. The webcam feed will open, displaying the real-time video stream. -
Hold the marker in front of the camera and start drawing. The application will track the marker's movement and render colored circles onto the screen accordingly.
-
Press the 'x' key to exit the application.