Rough Draw

Rough Draw

Rough Draw creates a sketchy, hand-drawn version of any image using RoughJS and a WASM version of OpenCV.

Technique

OpenCV is used to detect shapes (contours) in an image. At first, the image is transformed to grayscale and then a threshold function is applied.

If double pass is selected, an inverse threshold is also applied. Think of a double pass akin to applying a low-pass and a high-pass filter to a signal.

Contours are then extracted from the image followed by extracting the average color inside that contour.

The contour points are then passed to RoughJS which renders a sketchy version of the shape. The shape is then hachure-filled with the shape's average color.

Technique

Code and License

Github Repository

MIT License (c) Preet Shihn

Author image