CS580 Project 4: Nonphotorealistic Rendering

Jonathan Brumberg

April 26, 2006

Abstract

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.

1 Introduction

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.

2 Implementation

The algorithm is very straightforward and follows the outline below:

  1. Initialize brush strokes
  2. Compute filtered images
  3. Define Thin Plate Spline
  4. Determine brush stroke orientation
  5. Grow brush strokes
  6. Paint Brush Strokes using OpenGL

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.





  Base Value Perturbation



Stroke length [10-30] (28) pixels +U(1,20)
Stroke radius [2.5-8.0] (4.5) pixels +U(1,5)
Stroke orientation [0-90] (45) degrees ±U(-15,15)
Stroke spacing 2 pixels na
Gaussian Kernel width 15 pixels na




Table 1: Current implementation parameters

3 Results

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.


PIC
(a) Original Image
PIC
(b) Gaussian Smoothed Image
PIC
(c) Sobel Filtered Image
Figure 1: Base images



PIC
(a) Radius=6.0+dr, length = 30+dl, gradient-based orientation
PIC
(b) Radius=6.0+dr, length = 30+dl, random orientation
PIC
(c) Radius=2.5+dr, length = 10+dl, gradient-based orientation
PIC
(d) Radius=2.5+dr, length = 10+dl, random orientation
Figure 2: Impressionistic renderings of base image



PIC

Figure 3: Flow chart of impressionist NPR algorithm


4 Source Files

p4.c: Main file with code performing automated impressionist NPR algorithm
p4.h
TPS.c: Code for implementation of thin plate splines
TPS.h
jpegUI.c: Interface with JPEG library for image input/output
jpegUI.h
matrix.c: Matrix manipulation and linear algebra routines
matrix.h
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.

References

    Litwinowicz, P. (1997). Processing images and video for an impressionist effect. In Proceedings of the 24th annual conference on computer graphics and interactive techniques, pages 407–414. ACM Press/Addison-Wesley Publishing Co.