Inspiration

I'm trying to learn OpenCV and I thought VirtualPaint would be a great place to start.

What it does

VirtualPaint is an application that enables you to hold a coloured object (as a brush) to paint on your live video (as a canvas)

How we built it

VirtualPaint is built using C++ and OpenCV. I used Trackbarsand masks to identify each colour's HSV values and then gave it an appropriate approximation. I then found the contours of the object I was holding in my hand and created a bounding rectangle for it. Using the bounding rectangle, I used a little math to determine the tip of the 'pen'.

Challenges we ran into

I ran into challenges trying to eliminate noise when I was trying to correctly identify colours using masks. For example, the application frequently identifies blue and purple as the same colour and hence uses the same colour on the video canvas.

Accomplishments that we're proud of

VirtualPaint correctly recognizes Red, Green and Blue. It can recognize and paint multiple colours on the screen simultaneously. So if you wave three differently coloured pens, you get three different coloured lines. That's not something I can do on MS Paint.

What we learned

I learned about the basics of masks, contours, colour identification and drawing using OpenCV.

What's next for VirtualPaint

In the next version, I hope to be able to use the colour of the object itself as the pen colour instead of using an approximation to the colour. Furthermore, users will be able to save their drawings too.

Built With

Share this project:

Updates