Images Produced via Modular Multiplicative Inverse Filters
Year: 2019 Authors: Donald Spector
Core claim
Pairing pixel values by multiplicative inverses modulo a prime yields a flexible, reversible image-transform method that produces striking artistic styles.
Topics
image transformation, modular arithmetic, color mapping, aesthetic effects
Domains
modular multiplicative groups, number theory, finite fields, digital art, visualization, abstract art, pointillism, Warhol-like imagery
Methods
inverse mapping, parameter variation, transposition, RGB channel-wise transform
Media
grayscale images, RGB color images, digital photographs, album cover, still life
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.
Images Produced via Modular Multiplicative Inverse Filters
Donald Spector
Dept. of Physics, Hobart and William Smith Colleges, Geneva, NY, USA; spector@hws.edu
Abstract
I develop a technique for the manipulation and production of images using a rule based on the identification of inverses under multiplication modulo a prime number. This method allows for the production of images that repurpose the information of the original images in visually compelling ways, and by varying the parameters of the method, an array of different visual effects can be achieved. We explore the kinds of images that can result, as a way to understand some of the aesthetic impacts of this new item in an artist’s toolkit.
Introduction
In this paper, I explore a method for the manipulation of images based on the properties of the groups based on multiplication modulo a prime number. By varying the parameters in this technique, one can create an array of quite different artistic effects, as the examples I present will demonstrate. Thus we have a tool—which we think of as “modular multiplicative inverse filters”—based in mathematics that allows for an array of artistic expression, encompassing modalities reminiscent of psychdelic, abstract, and pointillist art, and more.
Manipulating what we see for aesthetic purposes is not a specifically digital phenomenon. Photographers use polarizers and filters, for example, to impact the form of the final image, and in developing film, adjusting the parameters of the process affects the outcome. Of course, digital image manipulation is now routine, with the ability to modify color, sharpness, contrast, and more.
The technique in this paper applies to images a methodology I previously employed to generate new musical lines [2]. While the mathematical underpinnings of the technique here and in [2] may be the same, the artistic impact is quite different. The visual arena allows for a broader array of possible implementations (while a musical scale has a fixed number of notes, the parameters that define a digital image such as brightness can be subdivided into any number of brightness levels), and, of course, visual media are simply different from audio media (e.g., there is not an analogue of chords). Thus, that this method has previously been used in the context of music is of academic more than artistic interest.
In this paper, I first review the relevant mathematics, and then introduce the methodology of modular multiplicative inverse filters in the context of grayscale images. The grayscale case turns out to be less interesting artistically, but it lays the groundwork for the case of color images, which I explore in the rest of the paper. We will see the array of artistic effects that can be produced, ranging from apparently abstract to visually recognizable images that re-map existing features in compelling ways.
Modular Multiplicative Groups
Two integers are said to be equal mod if they produce the same remainder when divided by . Thus, for example, . For any positive integer , the set of integers between 0 and relatively prime to form an abelian group [1], which we dub . Thus, for a prime number , the integers from 1 to form a group under multiplication mod , the group .
As is a group, each number from 1 to has an inverse with respect to multiplication mod . Both 1 and are always their own inverses; the remaining numbers are paired in a way that mixes up the elements in a non-uniform way. For example, in , the numbers 1 and 16 are their own multiplicative inverses, while 2 and 9 are inverses of each other, as are 3 and 6; 4 and 13; 5 and 7; 8 and 15; 10 and 12; and 11 and 14. This pairing of inverses in underlies our image manipulation technique.
Spector
Transforming Images: Grayscale
To introduce our method, we describe its application to grayscale images. In a digital grayscale image, each pixel lies somewhere on a scale from black to white. We will be working with for prime , so we label the range of grays with numbers from 1 to , starting with 1 for black, and increasing to for white as the grays get lighter.
To transform an image, we use the following rule. If in our labeling, if pixel is of a gray associated with the number , we change it to the gray level labeled by . Because of the way inverse pairs are mixed, this shuffles the light and dark shades, rather than moving the gray hues in a uniform, collective fashion. Choosing to be larger or smaller, as we will see, can dramatically change the transformed image.
To create more artistic freedom, we add one more parameter to this transformation. Above, we started with 1 for black to for white. Instead, we allow any of the levels of gray to be assigned the value 1, and then as the grays get lighter, step by step, increase the number associated with that gray by one. Once we get to white, we wrap around, so if white pixels are labeled by a number n < p - 1 , we label black by , and then increase the label for each successive lighter hue of gray by one until we get back to where we started. One can think of this as the visual equivalent of cyclically transposing the notes of musical scale, and so we refer to this as transposition. We still transform the image by shifting the gray hue of each pixel to , but now using this shifted numbering. All these transformations are one-to-one, and thus reversible.
Figure 1: An image of the author, followed first by four multiplicative inverse transformations of the image, and then by a transformation of the image.
To see how this works, we display an image of the author subject to these transformations. First, we see the original image and then several different transformations based on the group . Notice that the picture is still recognizable, but the features of the original image are distorted in unanticipated ways, reflecting the non-uniform mapping between lighter and darker pixels. On the other hand, the use of a transformation based on a larger value of —here, — produces an image that looks almost random. None of these images seem to be particularly compelling, but fortunately, once we incorporate color, things get more interesting.
Transforming Images: Color
The above method can be generalized to color images. For simplicity, we focus on RGB color images. In such an image, each pixel is labeled by three parameters, namely its brightness in each of the three color channels corresponding to red, green, and blue. We apply the methodology described above separately to each of the these three channels, labeling each pixel according to its brightness in each channel by a number from 1 to . We can associate 1 with black, with values increasing to as one reaches the brightest red, green, or blue, respectively. Additionally, as above, one can perform a transposition, cyclically shifting the assignment of the numbers from 1 to across the possible brightnesses. (For simplicity, in the examples below, in each given modified image, the values of and the transposition shift are the same across the three channels.) Thus each pixel in the original image has RGB values , while the corresponding pixel in the transformed image has the RGB values , where the inverses are taken in . These transformed pixels constitute the transformed image.
Images Produced via Modular Multiplicative Inverse Filters
This method maps the original information of the image in unfamiliar ways. Changing and shifting the transposition amount can each modify the results dramatically. The resulting images vary according to their color palettes, the sharpness of color variations, and the overall recognizability of the source material. The remainder of the paper provides examples of the kinds of images and effects that can be produced.
We begin with a still life, show in Figure 2, which presents an original image, followed by its four transformations (each possibility corresponding to a different transposition). Characteristic of the inverse pairing process, subtle changes in the original image become substantial in the final image, and the different transpositions produce very different color palettes.
Figure 2: “Still life with babkas.” An image and its four transforms.
Figure 3: An image of Henry Tye juxtaposed with a transform sandwiched between its transforms.
To see the effect of the size of , consider Figure 3, with its images of physicist Henry Tye. A larger transform of the original image (which is displayed to the left) is sandwiched by all twelve transforms. The transforms provide results similar to psychedelic art. The transform fills an unusual niche: it is evocative of pointillist art, but while there is a suggestion of a face, a familiar image never comes into view.
A quite different effect of changing appears in Figure 4, with a picture of the Statue of Liberty next to “Emerging Liberty,” which contains a series of transformations corresponding to , 39119, 2017, 257, 43, and 17. One sees that the variation in blues of the sky turns into rainbow-like sets of colors, with varying color palettes, but even more strikingly, one sees that the large values of produce muted images, and the smaller values create brighter “neon” images. Unlike the preceding examples, large values of are still effective here, but concatenating the decreasing values produces a sense of something emerging.
In Figure 5, we see the sixteen transforms of the cover of a cold weather boy album. This image collection has a feel akin to a Warholesque silkscreen, quite different from Figure 3. Next to it, we see an original and a -transformed image from a cold weather boy performance at a small club; in many ways, the altered image better suggests of the mood and feel of the performance than the unaltered image.
Our final image, in Figure 6, is a still life, as was our first color image. In addition to performing a transform, I have rescaled the aspect ratio of the image. The resulting image is a visually coherent but apparently abstract image, which is really just a still life mapped in an unexpected way.
Spector
Figure 4: The Statue of Liberty and the author’s work “Emerging Liberty,” which combines transforms from very large to small values of .
Figure 5: A cold weather boy album cover; its sixteen transforms make “cold warhol boy”; and finally an image from a cold weather boy performance, original and modified under a transform.
Figure 6: Abstract still life: original image and its apparently abstract -transform.
Conclusion
This paper has introduced a new method for manipulating and transforming images based on the pairing of inverses in modular multiplicative groups of order , where is a prime. By varying , one can change the overall effect, with larger producing more muted images, and smaller producing more vibrant colors. Varying the transposition yields different color palettes. One of the more compelling features of this method is that it is a single methodology that can produce images of quite varied styles: from abstract art to forms that echo aspects of pointillism, Warhol, and psychedelic art. The power of this technique, therefore, lies in the hands of the artist, as it opens new spaces for artistic exploration that provide a smorgasbord of possibilities.
References
[1] T.M. Apostol. Introduction to Analytic Number Theory. Springer-Verlag, 1976. [2] D. Spector, Musical Scales and Multiplicative Groups, in Proceedings of Bridges 2018, Tessellations Publishing, Phoenix, 2018, pp. 387-390.