@pedrobzz

Hey there, my name is Pedro Bzz and I'm a developer who's head over heels in love with Typescript. As a full-stack developer, I've got the skills to build an application from start to finish, both front-end and back-end, and my passion is using technology to make my life (and users' lives) easier and better. I'm always keeping an eye out for the latest technologies in the market, and I love the idea of having an amazing "Developer Experience", meaning that working with me is always easy!

Friday Finance

Balneário Camboriú, Santa Catarina - Brazil

Developing since January 2018

React, Next.js, TypeScript, Tailwind CSS, Vue, GraphQL, Node.js, Express and tRPC

profile picture
Pedro Bzz

@pedrobzz

SketchEverything is a Python-based AI prototype that I developed from the ground up using OpenCV, NumPy, and a lot of math. Despite its simplicity, the underlying complexity of the project makes it truly unique.
By accepting an image as input, SketchEverything undergoes a series of image processing techniques to create a sketch-like version of the original image. Once the user confirms that the image looks good, the AI utilizes Microsoft Paint to replicate the image in a way that resembles a human artist's hand. The final result really impressed me, and I know it will impress you too!

132
profile picture
Pedro Bzz

@pedrobzz

I started working on SketchEverything in March 2021, and to be honest, I had no idea how I was going to do it, but I knew how to start. I chose OpenCV for image processing because it's the best (and my favorite) way to manipulate images, and also NumPy, since NumPy allows you to manipulate images and perform complex mathematical operations in conjunction with OpenCV.

132
profile picture
Pedro Bzz

@pedrobzz

The idea was never to create a neural network, as although I had already created some small and simple ones, such as CNN for OCR, I assumed that jumping from a simple neural network to an extremely complex one was not the most obvious leap, so I preferred to focus on good old math.

Initially, the focus was on simple images, where I simply turned them into a binary image and translated the location of "positive" pixels to the computer screen's location, allowing the image to be drawn in Microsoft Paint.

132
profile picture
Pedro Bzz

@pedrobzz

Soon the first problem was identified. The algorithm "printed" the drawing as if it were a printer, going from top to bottom, but humans do not draw like this, so it was necessary to think of a better algorithm. The idea is simple, use linear algebra to calculate the distance between two points and find the closest point, and then create a list of all the pixel coordinates.

132
profile picture
Pedro Bzz

@pedrobzz

But it's not so simple either, so an "inertia" algorithm was developed that allows the algorithm to understand when it is making a "line," so it can continue doing the same part of a drawing, because think about it, a person drawing a shirt is not going to stop drawing it halfway to draw another part of the body, they will continue drawing until they reach the end of the shirt and then draw the rest of the body.

132
profile picture
Pedro Bzz

@pedrobzz

And then the academic phase began, I took several algebra and calculus courses to develop this algorithm and ensure that it is optimized, and this made me learn a lot about optimization and data structures, since structures such as KD-Tree were essential to achieve this goal. In addition, I began to see image processing algorithms to use more complex images, and not just simple images like drawings and anime characters.

132
profile picture
Pedro Bzz

@pedrobzz

After extensive development, I created a Twitter account for the AI and began posting timelapses of the drawings. From there, the development became extremely straightforward, with two main areas to focus on: optimizing the code and improving image processing.

To do this, I developed various image filters and even included some sliders for fine-tuning the result to ensure that the algorithm could achieve the best result regardless of the image.

132
profile picture
Pedro Bzz

@pedrobzz

I invite you to check out the SketchEverything Twitter account clicking on the gif above, as there are some videos that demonstrate the script and, even though not half of the drawings have become videos, the selection of videos there is very interesting and shows how the algorithm has evolved over time!

15.2k Views

132 Retweets

1.7k Likes