Skip to main content

Non photorealistic rendering in Java - introduction

Posted by kirillcool on March 25, 2007 at 12:27 AM PDT

Non photorealistic rendering (or NPR for short) employs a variety of artistic techniques, such as stippling, watercoloring, stylizing, mosaicizing etc. to render digital images. Unlike photorealistic rendering which can use modeling of physical phenomena (lighting, shading, 3D modeling etc), NPR tries to mimic certain artistic styles, which are more difficult to quantify and express in mathematical domain. However, we can still employ a variety of techniques to facilitate implementation of a wide selection of NPR effects. As my proposal on this subject was rejected by this year's JavaOne committee (no worries, i still have a technical session with Alex and a BoF with Richard and David), i have decided to publish a series of entries on this subject.

The code is hosted at ixent.dev.java.net, and the subsequent entries in this series will provide much more information on each one of the project building blocks. Here is a short introduction (click on the thumbnails to view full screenshots).

The application has one main screen that allows selecting the original image and changing the default parameters:

Use the breadcrumb bar to select the original image:

After changing the various parameters that affect the image processing (more in the next entries), click Start button and the process starts (note that the UI is made "disabled" during this process using JXLayer which allows disabling some portions of UI and installing custom painting). One of the first steps is edge detection:

One of the next stages is the tesselation of the original image based on the automatically extracted structure information (edges, segments). Note how the tesselation polygons are smaller around the structure edges. In addition, note how the tesselation polygons scale up away from the edges, providing semi-random homogeneous coverage of the image area:

The final result is computed based on the color information of each one of the tesselation polygons (all mosaic cells falling into the specific polygon have the same color) and the structure edge orientation (mosaic cell orientation follows the orientation of the nearby edges):

See you in the next installments.

Related Topics >>