A Nonphotorealistic Rendering (NPR) technique to create painterly-renderings of images in impressionistic style was implemented. An algorithm from Litwinowicz (1997) was used to create an automated system for simulation of paint-brush strokes. A method for maintaining stroke orientation coherence was used and compared to random brush orientations.
Litwinowicz (1997) outlines a method for automated impressionist rendering of digital images. This algorithm was implemented (as described below) and results of adjusting system parameters was examined and discussed. The main feature of Litwinowicz’s (1997) algorithm is a method to accurately infer brush stroke orientation information from areas of the gradient image with little information. Such inference was accomplished using Thin Plate Splines.
The algorithm is very straightforward and follows the outline below:
Table 1 outlines the parameters used in the current implementation. The user is able to change parameter values within the ranges specified in Table 1 by pressing an appropriate keyboard button: (l)ength, (r)adius, (t)heta–orientation, [space] to toggle random/gradient-based orientations.
Figure 1 contains the base, gaussian smoothed and sobel filtered images used for impressionistic rendering. Figure 2 shows the results of the rendering algorithm over a few parameter ranges. The category of results are broken down as large or small brush strokes (wide and long) as well as randomly oriented vs oriented along the normal of the gradient. Changing the size of the brush stroke has only the effect of changing the style of the painting. Smaller brush strokes begin to appear more pointillist while larger strokes look more impressionist. The larger difference occurs when we shift from randomly oriented strokes to gradient-orthogonally aligned orientations. Using the normal-to-the-gradient produces an effect conveying coherence and flow throughout the image. Random orientations do not possess that attribute. Nonetheless, either technique can be used based on the user’s preference without a decrease in performance.
The gradient images are decimated by a factor of 10 before the thin plate splines are initialized. Given this parameter (and those specified above) the total runtime of the current implementation is between 6-8 sec on an AMD Opteron 64 with NVidia Quadro FX 1100 graphics card. Decreasing the decimation factor greatly increases the running time as a much larger inverse matrix must be computed during the TPS initialization. Also, increasing the grid spacing decreases the number of brush strokes needed, therefore computation time decreases.
p4.c: Main file with code performing automated impressionist NPR algorithm
TPS.c: Code for implementation of thin plate splines
jpegUI.c: Interface with JPEG library for image input/output
matrix.c: Matrix manipulation and linear algebra routines
makefile: Makefile with automatic detection of options for compilation under Linux (x86_64) or Windows (using Cygwin)
brumberg-p4.tgz: Tarball of relevant source, header, object and executable files
The above files require libgl, libglu, libglut, libjpeg and libm. They were compiled on an x86_64 machine running Linux. The makefile also supports Windows machines running Cygwin.