The Source for Java Technology Collaboration
User: Password:



Kirill Grouchnikov

Kirill Grouchnikov's Blog

Non photorealistic rendering in Java - introduction

Posted by kirillcool on March 25, 2007 at 12:27 AM | Comments (6)

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.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Very interesting project and nice UI. It reminds me of Aperture and Microsoft's Expression suite (or whatever its name is.) Do you have "real-life" examples of NRP usages? I have to admit that besides cell-shading in video-games, I'm clueless.

    Posted by: gfx on March 25, 2007 at 06:43 AM

  • Good stuff. Looking forward for more coverage, especially the various algorithms used.

    Posted by: juhalindfors on March 25, 2007 at 08:31 AM

  • Nice. What imaging API did you use? Java2D, JAI, another or your own?

    Posted by: fabriziogiudici on March 25, 2007 at 02:04 PM

  • Romain - i've seen a few commercials (for cars) that use NPR techniques to take a regular video shoot and apply watercolor / stylizing to make it appear hand-drawn (remember the "Patch Adams" movie)?

    Posted by: kirillcool on March 25, 2007 at 04:09 PM

  • Fabrizio - it was written a couple of years ago over Java 1.0, so i used my own imaging API (composites, colors, anti-aliasing and even loading of TTF files). A few months ago i moved it to Java 6.0 and replaced most of the above with Java2D.

    Posted by: kirillcool on March 25, 2007 at 04:11 PM

  • Nice user interface. Looking forward to how the various algorithms are used and how one can incorporate other algorithms. Nice work.

    Posted by: lifeisadancer on April 02, 2007 at 11:32 PM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds