Categories

# Scribble Art

Let’s scribble! There are other papers that have used scribbling for halftoning images, but I want to add a bit more math.

A simple model is to have a circle that travels along a base curve. We can parameterize this as:

\begin{aligned} x&=x_0+r \cos\left( \frac{2 \pi x_0}{\lambda} \right) \\ y&=r \sin\left( \frac{2 \pi x_0}{\lambda} \right) \end{aligned}.

To use this for halftoning, we should know the curve length (per period) as a function of the wavelength $\lambda$ and radius $r$. For simplicity in the result, let’s non-dimensionalize the radius as $r_0=r/\lambda$. We can find the scribble length with math:

\begin{aligned} \frac{ds}{dx_0}&= \sqrt{ \left( \frac{dx}{dx_0} \right)^2 + \left( \frac{dy}{dx_0} \right)^2 } \\ L&= \int_0^\lambda \frac{ds}{dx_0} d x_0 \\ &= \frac{\lambda}{\pi} \left( |1-2 \pi r_0| E \left(\frac{-8 \pi r_0}{(1-2 \pi r_0)^2} \right) + (1-2 \pi r_0) E \left(\frac{8 \pi r_0}{(1+2 \pi r_0)^2} \right)\right) \\ &\approx \lambda \sqrt{1+(2 \pi r_0)^2} \end{aligned}

where E(x) is the elliptic integral of the second kind.

To use this for halftoning, let’s say that we have a line of width w running through the middle of a band of width H. And have the darkness of the like (from 0-1) be k(x). First, let’s rescale the darkness to be between the minimum and maximum possible values:

$k_2 = k (1-\frac{w}{H})+\frac{w}{H}$

We want the darkness of the scribble to match that of the image band. That means $k_2=Lw/(H\lambda)$. Let’s call the scribble length per wavelength $\alpha=L/\lambda$. Then we find $\alpha=1+k_2(H/w-1)$. This relates the curve length to the image darkness.

Now we have the desired (scaled) curve length, we can either set the wavelength or the radius, and leave the other free to match the desired curve length. If we set the radius, we have $\lambda=2 \pi r/\sqrt{\alpha^2-1}$. If we set the wavelength, we get $r =\lambda \sqrt{\alpha^2-1}/(2 \pi)$. To further define that, we can define a maximum radius $r_{max}$, and find the wavelength that yields that, resulting in $\lambda=2 \pi r_{max}/\sqrt{(H/w)^2-1}$.

How do these look? First, to show the styles, I’ll use squiggles along a Hilbert curve, with a maximum radius of one quarter of the spacing, just to highlight the style.

The wavelength variation seems more appealing, since it lacks the sharp corners in the lightest region. Now lets try a denser curve with two larger radii.

Yep, the wavelength method continues to look better. Also, comparing these two shows that a double-width radius results in blurrier images, but there are fewer visible artifacts. Let’s try it with an image! First, a zoomed-in version of the Mona Lisa:

Yep, more overlap leads to fewer artifacts, but more blurriness. The swirliness does a good job of disguising the base curve, for the wavelength-based method. Here’s a higher resolution result, where the base curve is a maze:

It generally works! The main problem with this approach is that the math doesn’t take into account the fact that the lines overlap. As a result, the image won’t be as dark as expected. But it’s pretty good!

This site uses Akismet to reduce spam. Learn how your comment data is processed.