Skip to content
Stylize images and videos as crosshatched drawings
C++ Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Use OpenCV to create crosshatch-style drawings and videos.

Try out a canvas-based implementation at

To use:

$ make
$ ./crosshatched sources/goldengate.jpg
$ ./crosshatched --laplacian sources/thailand.jpg
$ ./crosshatched path/to/a/video.mp4

This script is optimized for images and videos >= 1080 pixels wide. You can also get decent results out of smaller images by tweaking the constants although bigger seems to be better in most cases.

There are a bunch more flags too worth playing around with

The algorithm:

  • Calculate the gradient of the image
  • Draw short, connected bezier lines parallel and perpendicular to that gradient
  • Generate the "edge gradient" from either the Laplacian or Canny (default) algorithms
  • Using slightly tweaked rules, draw more bezier lines parallel to the edge gradient


  • g++ (Part of the GNU Compiler Collection)
  • OpenCV
  • Tons on other stuff (install everything one error at a time)


I'd love to pipe this through a neural-network style-transfer first to get something really artistic

A note:

I'm generally a Python programmer so please forgive my shitty C++ code. I'm also not at work so I'm not keeping my code clean

You can’t perform that action at this time.