Categories

# Stripes: Laplacians

What if we want stripes to respond to an image? Well, we can make a version of the image that has gradients that are roughly parallel to those of the original image. Then we can use those as the basis of some stripes.

Say we want a phase field $J$ that has gradients that are parallel to the gradients of the image, $I$. That is, I want $\nabla J \approx \left( 2 \pi \nabla I \right)/ \left( \lambda |I | \right) = F$. An approximation of this can be found through Laplacian relaxation. This is a method of trying to iteratively step toward a solution of Laplace’s equation.

$J$ is initialized as $I*0$ . The following is a single iteration. First, the relaxation step, then correction of the linear gradients, then re-zeroing. The factor $a$ needs to be scaled to allow for a small enough step to avoid over-shooting, but large enough to converge quickly.

\begin{aligned} J &= J+a \left( \nabla^2 J-\nabla \cdot F \right) \\ [J_x,J_y] &= \nabla J \\ J &= J+X\left( X \setminus \left(F \cdot \hat{x}-J_x \right) \right) + Y\left( Y \setminus \left(F \cdot \hat{y}-J_y \right) \right) \\ J &= J-min(J) \end{aligned}

This is a slow method if done at full scale, as it depends on the diffusion of the proper fit. A multi-scale approach greatly speeds this up. Start with a much smaller image, say 10 pixels across the maximum dimension. Run the above algorithm for a set number of iterations, or to convergence. Rescale the tiny estimate to twice its size and repeat until the final solution is reached.

The image at the top of this post was made with an attempt for a constant wavelength. Instead, aiming for for constant stripe width:

These have mostly continuous lines, but still have odd little patches of light and dark. Still a neat effect!

If I draw the center of the lines with constant width, we get something that looks… strange. Hm. Well, not all experiments are great successes.

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