Computer Graphics Laboratory 234326 Winter 2007-2008 Non-Realistic Rendering Photo Laborer By Milena Natanov Supervised by Gershon Elber Agenda About Non-Realistic Rendering About Photo Laborer

Photo Laborer Terms Photo Laborer Design and Implementation Possible extensions Results

About Non-Realistic Rendering Non-photorealistic rendering (NPR) is an area of computer graphics that focuses on enabling a wide variety of expressive styles for digital art and producing drawn by hand images using computer. About Non-Realistic Rendering Illustrations have many advantages over Photorealism:

Focusing attention Clarifying & simplifying shapes Exposing parts that are hidden Sketching/Illustrating approximate ideas Conveying mood and emotion Art, beauty, expression Aaron Hertzmann Paint by Relaxation This project is based on the work Paint by Relaxation published by Aaron Hertzmann in May 2000. Main aspects this research is focused on: Input: photo created by digital camera Output: image painted by artist The painted image is created from the original image by

adding strokes to the clean canvas The painted image created with minimal energy cost Painting style varies in accordance to different parameters user defines. About Photo Laborer Photo Laborer implements the ideas presented in Paint by Relaxation research, with few changes: Output image is built adding strokes on clean, white canvas Several painting styles supported built-in (Realism, Watercolor, etc), user can define custom styles

Processing time: several minutes for 800x600 image! The research mentions that paint time takes hours. Easy Graphical User Interface, includes user manual User can re-paint specific areas with different painting styles User can add custom strokes

Photo Laborer Terms - Brush A brush is a real brush stamp on the paper in specific point on the canvas. In the current Photo Laborer version, brush is characterized by: brush min and max radius (width = radius * 2 + 1) color texture (solid or with dark and bright lines) In this version, user can control the width and the darkness/brightness deviation of the brushs color

Customized brushes can be added in the future improvements Photo Laborer Terms - Stroke A stroke is a thick curve defined by a list of control points, curvature, and the brush selected for it. Control points are than fine-tuned into thin (one-pixel) line using cardinal curve algorithm, forming strokes backbone. Stroke is drawn by moving the brush over the backbone

pixels Each move will print the brushs texture on the canvas Each texture is rotated by the appropriate angle to give the stroke real look User can add custom strokes using GUI by selecting the control points Photo Laborer Terms Painted Image Painted image is defined as a collection of brush strokes. The painted images size is the same as the size of the original image.

A painting is rendered by compositing the brush strokes in order they appear onto the canvas User sees the changes during the processing time and can cancel the operation in the middle Photo Laborer Terms Energy Ideally, each stroke should consist of pixels that have similar or almost similar hue. Energy difference between two colors is Euclidean distance between RGB values of these colors:

sqrt(redDiff2*greenDiff2*blueDiff2) Photo Laborer uses this formula to calculate the quality of the stroke which is defined as an average energy difference of stroke colors with original colors on the image Photo Laborer also uses energy difference to improve stroke building algorithms details are described in the next slides Photo Laborer Terms Direction To speed up processing time and increase the quality of

created strokes, Photo Laborer tries to build strokes that match the image contours Photo Laborer searches for object contours on the image (using special heuristics described later) and associates suggested Direction with each pixel identified as a contour Later, when stroke points are selected, Photo Laborer uses the direction information to make the stroke compliment objects contour Photo Laborer Implementation

Photo Laborer application is implemented in C++ Development environment: Visual Studio 2005 Libraries used: wxWidgets: GUI, Image processing, XML, threads I used latest version available on the web: 2.8.9 Standard Template Library: , , etc

Tested on Windows XP and Vista The code does not use any Windows-specific API, so it can be recompiled and adjusted for use on any platform supported by wxWidgets Photo Laborer Components Each component is described later in details. GUI components Main Frame, Photo Control, Paint Style Dialog

Logic components Image Processor, Image Energy Paint Style Manager Building blocks Paint Brush and Texture, Paint Style Helper classes Shape Algorithms , Direction, Randomizer, Worker Thread Graphical User Interface (GUI)

Main Frame Navigation menu Toolbar menu Original image Painted image (also user can see energy or direction tables ) Photo Control Displays the image (original, painted, tables) Allows painting area and stroke points selection Paint Style Dialog View styles and their parameters Add new, edit or delete existing styles

Logic Components Image Processor and Image Energy Hold energy table, per-pixel information (color and suggested direction, if any) Implement the main painting functionality Paint Image / Area, Add Stroke, etc Paint Style Manager Loads / Saves paint styles from / to XML that resides in user profiles folder

Building Blocks Paint Texture Strokes stamp on the canvas: list of pixel, each one holds colors strength (bright/dark) and coordinates relative to textures center Paint Brush Define how the brushs stamp (texture) looks like for each radius and angle Photo Laborer supports two kinds of brushes: Solid brush: generates 3-pixels wide textures with same color Random brush: creates dark or bright lines within the texture

Cache for fast performance, this class caches the textures for each angle/radius pair Paint Style Defines style parameters (such as maximal stroke length) Photo Laborer comes with several built-in styles, user can add custom ones Photo Laborer Algorithms The main data structures and algorithms Photo Laborer is based on are: Energy table Direction table Stroke creation

Stroke rendering on the painted imagery Energy Table Energy table describes the energy of each pixel relative to its neighbors. Neighbors are defined by the stroke average radius (width = radius*2 + 1): pixels on the circle with this radius are used as a neighbors. This table is pre-computed before painting. It used for two purposes: Selecting the next stroke start point.

Low energy points have better change to match the image thus they are selected first. Calculate direction table. Direction Table Direction table aims in creating strokes that match the contours on the image. When stroke control points are selected, Direction table is used to check the location of the next control point. This table is calculated before painting

process starts Special heuristic algorithm based on energy table is used to calculate whether or not the pixel is on contour, and, if yes, tangent is calculated and saved in Direction table. Stroke Creation Choose the next non-covered pixel from the list of non-covered pixels sorted by their energy (from low energy to high). Choose the rest control points using direction

table This pixel is the first control point of the new stroke. or randomly if direction is not available Build the stroke (cardinal curve) over the control points according to users style (length, curvature parameters). Strokes backbone:

Stroke Creation cont. For each pixel in strokes backbone line, apply brushs texture on it Brush texture is created from brush texture image, rotated by tangent of the current pixel. Rotated textures: Rotated textures are cached for fast performance after the

creation Resulted stroke: Current version supports darkening and brightening of the texture Painting Style Painting style is defined by below parameters:

Style name. Brush [minimal, maximal] radius, in pixels. Stroke [minimal, maximal] length, in pixels. Stroke curvature (maximal number of control points). Brightening/darkening of the main strokes color Built-in styles: Hyperrealism, Realism, Impressionism, Expressionism, Pointillist, Watercolor User can add custom styles Possible extensions This system may have various nice features that can be added in the future in order to make it even more

attractive: Undo/Redo changes. Rich stroke textures User-provided textures Textured canvas (background): wood, paper, silk, etc

Results Results Results Results Thank you!

Recently Viewed Presentations

  • March 29, 2011 Objective: TSW identify events of

    March 29, 2011 Objective: TSW identify events of

    Objective: TSW identify events of the Cold War by taking notes, Hook: Describe Europe after WWII by using ALL of the following terms: Germany. ... If more than one group of non-dots is infiltrated by only one dot, the dot...
  • PowerPoint Presentation

    PowerPoint Presentation

    IDeA-CTR Program Grant. Awarded to UNMC September 1, 2016. 5-year project (renewable) $4 million per year. 4 states. 9 institutions. 7 key components. 2 major programs
  • Summarizing Data - Statistics Department

    Summarizing Data - Statistics Department

    Multivariate numerical data. Each dimension in multivariate data is univariate and hence, we can use the numerical summaries from univariate data (e.g. sample mean, sample variance) However, to study two measurements and their relationship, there are numerical summaries to analyze...
  • Intrusion Detection: Catch the bad guys before they ...

    Intrusion Detection: Catch the bad guys before they ...

    Manuel Humberto Santander Peláez GIAC GCFA Gold, GNET Silver, GCIA Gold Network Security Perimeter Firewalls NIDS/NIPS VPN Concentrator NAC (Switches) Antivirus Antispyware Content Filtering Network Security Perimeter Firewall Switch (NAC) VPN Concentrator NIDS Security Event Correlator Network Forensics Capture, recording...
  • Joan Jett - University of Minnesota

    Joan Jett - University of Minnesota

    Joan Jett was a popular musical icon of the 1980's. She is widely recognized for her hit "I love Rock n' Roll" , her punk rock appearance, and attitude. Our group picked Joan Jett as our topic because there has...
  • Adjective Agreement and Placement

    Adjective Agreement and Placement

    In French, adjectives are placed AFTER the noun. Naturally, there is an exception called BANGS (but that is a whole different lesson that we will work on after you get this one down!). Now you try! The blue backpack Le...
  • First Semester Review

    First Semester Review

    Lipid. Protein. Nucleic Acid. Elements: ... Which indicator would be used to test for a complex carbohydrate? If a banana tests positive for complex carbohydrates, what color would the solution be? Sudan IV will turn reddish orange if which macromolecule...
  • enthalpy of formation (DHf): the enthalpy change associated

    enthalpy of formation (DHf): the enthalpy change associated

    standard enthalpy of a reaction (DHo. rxn):. DHo. rxn is the change in enthalpy. of a reaction when all substances. are in their standard states (i.e., at 25oC).-- Using Hess's law, we can