Representational Random Walks

Year: 2016 Authors: Max Grusky

Core claim

By adjusting step, perturbation, and segment count, a bounded random walk can generate visually similar image reproductions with controllable contrast and sharpness.

Topics

random walks, image reproduction, generative art, parameter variation

Domains

stochastic processes, discrete geometry, computational mathematics, visualization, generative art, media arts

Methods

bounded random walk, pixel brightness mapping, parameter sweep, Processing implementation

Media

digital images, line segments, Processing

Paper text

The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.

Bridges Finland Conference Proceedings

Representational Random Walks

Max Grusky Oberlin College mgrusky@cs.oberlin.edu

Abstract

By shortening and lengthening its individual segments in accordance with an underlying target image, we can encourage a random walk to reproduce the target image.

Introduction

Regular two-dimensional random walks produce interesting images by themselves. When bounded by the dimensions of a desired output image, they produce a complex marbled texture: darker in areas where the path has doubled back on itself frequently, and lighter in areas less traveled.

The goal of representational random walks is to manipulate the positioning of these lighter and darker patches so that they correspond with the light and dark portions of an image.

Method

img-0.jpeg Figure 1: Varying segment length between and based on the value of the current pixel. Other possible segments shown in gray.

Representational random walks are composed of line segments connected to each other by random angles. If the random walk lands on pixel , it observes the brightness of this pixel. The pixel can range between if the pixel is perfectly dark, to if it is perfectly white.

Segment length depends on the step and perturbation values. Each segment’s length varies linearly between and based on the darkness of the pixel its starting point is currently sitting under, for p > 0. For , the representational random walk turns into a regular random walk. For near zero, the walk spends more time filling in dark areas and jumping over light areas. Let be the position of the random walk at time . For a randomly generated angle :

A line segment is then drawn between and , where is bounded by the dimensions of the image.

The reason for introducing a perturbation value in addition to a step value is to handle the unfortunate situation where , solid black. In this case, and , and the random walk will get stuck in the “black hole.” With zero perturbation, even patches of near-black can cause the path to slow down and take much longer to fill out the image. Adding a nonzero perturbation solves this problem.

Grusky

img-1.jpeg Example: Random Dog Walk

img-2.jpeg

img-3.jpeg Figure 2: Clockwise, starting from the top left. Representational random walks of (a) 100,000 segments, (b) 1,000,000 segments, (c) 5,000,000 segments, and (d) 10,000,000 segments. The expanded image at the top is darkened slightly to increase visibility.

Representational Random Walks

The examples above were produced using Processing [2]. The original image is pixels, with a step set to 10 pixels and a perturbation set to 1 pixel. A segment leaving a perfectly white pixel moves a distance of 11 pixels in a random direction, while a segment leaving a perfectly dark pixel moves a distance of 1 pixel. Finally, each line segment has a thickness of 1 pixel and an alpha value of 0.02, allowing for a larger variation in output values through overlapping lines.

Varying Step and Perturbation

img-4.jpeg

img-5.jpeg

img-6.jpeg Figure 3: Representational random walks with 5,000,000 segments where (a) , ; (b) , ; (c) , , and (d) , .

img-7.jpeg

Instead of varying the number of segments (), these images show different combinations of step () and perturbation (). Increasing perturbation increases the coverage of the image by allowing more random jumping regardless of pixel color, while decreasing perturbation increases image contrast by encouraging the random walk to stay within dark regions longer.

Increasing step size also increases image coverage, but decreases sharpness as individual line segments span longer distances and are less representative of the pixels directly underneath them. Decreasing step decreases the result’s representativeness of the target image by making it act more like a typical bounded random walk. The amount of randomness of a representational random walk is best described by , the fraction of a line segment’s length that is determined by its starting pixel.

These four images were also drawn with a thickness of 1 pixel and an alpha value of 0.02. For source code and more examples using Processing, see [1].

Conclusion

By manipulating three parameters — step (), perturbation (), and number of segments () — a representational random walk can generate strikingly different reproductions of a target image. The images produced can have varying amounts of contrast, sharpness, and white space based on the configuration of the representational random walk. However, while representational random walk images are created through a random process, they are still visually similar to the original.

References

  • [1] Max Grusky. Representational random walks. https://maxgrusky.com/posts/random-walks, 2016. [As of March 15, 2016].
  • [2] Casey Reas and Ben Fry. Processing: programming for the media arts. AI & Society, 20(4):526–538, September 2006.

0 items under this folder.