Computer Graphics. Si Lu. Fall er_graphics.htm 10/11/2017

Similar documents
CS559: Computer Graphics. Lecture 6: Painterly Rendering and Edges Li Zhang Spring 2008

CS559: Computer Graphics

What and Why Transformations?

Determining the 2d transformation that brings one image into alignment (registers it) with another. And

CS770/870 Spring 2017 Transformations

Last Time. Correct Transparent Shadow. Does Ray Tracing Simulate Physics? Does Ray Tracing Simulate Physics? Refraction and the Lifeguard Problem

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CS 2770: Intro to Computer Vision. Multiple Views. Prof. Adriana Kovashka University of Pittsburgh March 14, 2017

Image Metamorphosis By Affine Transformations

Today s class. Geometric objects and transformations. Informationsteknologi. Wednesday, November 7, 2007 Computer Graphics - Class 5 1

Image Warping, mesh, and triangulation CSE399b, Spring 07 Computer Vision

What does OpenGL do?

M O T I O N A N D D R A W I N G

Image Warping. Computational Photography Derek Hoiem, University of Illinois 09/28/17. Photo by Sean Carroll

Warping, Morphing and Mosaics

CS F-07 Objects in 2D 1

Chap 7, 2009 Spring Yeong Gil Shin

Computer Graphics. Geometric Transformations

4. Two Dimensional Transformations

Geometric Model of Camera

Last Lecture. Edge Detection. Filtering Pyramid

CSE328 Fundamentals of Computer Graphics: Theory, Algorithms, and Applications

CS Computer Graphics: Transformations & The Synthetic Camera

Two Dimensional Viewing

Computer Graphics. Geometric Transformations

Image Warping. Some slides from Steve Seitz

Fitting a transformation: Feature-based alignment April 30 th, Yong Jae Lee UC Davis

Introduction to Homogeneous Transformations & Robot Kinematics

Modeling Transformations

Prof. Feng Liu. Fall /25/2018

Lecture 4: Viewing. Topics:

Image Warping : Computational Photography Alexei Efros, CMU, Fall Some slides from Steve Seitz

1. We ll look at: Types of geometrical transformation. Vector and matrix representations

CSCI-4530/6530 Advanced Computer Graphics

To Do. Course Outline. Course Outline. Goals. Motivation. Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

3-Dimensional Viewing

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

Matrix Representations

Non-photorealistic Rendering

Image Warping (Szeliski Sec 2.1.2)

Image Warping CSE399b, Spring 07 Computer Vision

Midterm Review. Wen-Chieh (Steve) Lin Department of Computer Science

Modeling Transformations Revisited

The 3-D Graphics Rendering Pipeline

IMGD The Game Development Process: 3D Modeling and Transformations

How is project #1 going?

Painter s Algorithm: Problems

Street Artist Teacher support materials Hour of Code 2017

Interactive Computer Graphics. Warping and morphing. Warping and Morphing. Warping and Morphing. Lecture 14+15: Warping and Morphing. What is.

Geometric Image Transformations and Related Topics

CPSC 314, Midterm Exam. 8 March 2010

Notes. University of British Columbia

Core Graphics and OpenGL ES. Dr. Sarah Abraham

Hiding faces on videos:

More on Transformations. COS 426, Spring 2019 Princeton University

To Do. Computer Graphics (Fall 2004) Course Outline. Course Outline. Motivation. Motivation

3D graphics rendering pipeline (1) 3D graphics rendering pipeline (3) 3D graphics rendering pipeline (2) 8/29/11

Introduction to Homogeneous Transformations & Robot Kinematics

CS770/870 Spring 2017 Transformations

Think About. Unit 5 Lesson 3. Investigation. This Situation. Name: a Where do you think the origin of a coordinate system was placed in creating this

Scene Graphs & Modeling Transformations COS 426

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center

News. Projections and Picking. Transforming View Volumes. Projections recap. Basic Perspective Projection. Basic Perspective Projection

LESSON 3.1 INTRODUCTION TO GRAPHING

Homogeneous Coordinates

Modeling Transformations

Projections. Brian Curless CSE 457 Spring Reading. Shrinking the pinhole. The pinhole camera. Required:

Transformations III. Week 2, Fri Jan 19

3D Coordinates & Transformations

High Dimensional Rendering in OpenGL

MEM380 Applied Autonomous Robots Winter Robot Kinematics

CSCI-4530/6530 Advanced Computer Graphics

CS 335 Graphics and Multimedia. Geometric Warping

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

3D Geometry and Camera Calibration

Transformations II. Week 2, Wed Jan 17

5.6 Translations and Combinations of Transformations

STRAND J: TRANSFORMATIONS, VECTORS and MATRICES

STRAND I: Geometry and Trigonometry. UNIT 37 Further Transformations: Student Text Contents. Section Reflections. 37.

Affine and Projective Transformations

Image warping. image filtering: change range of image. image warping: change domain of image g(x) = f(h(x)) h(y)=0.5y+0.5. h([x,y])=[x,y/2] f h

Animation is the illusion of motion created by the consecutive display of images of static elements. In film and video

(x, y) (ρ, θ) ρ θ. Polar Coordinates. Cartesian Coordinates

CMSC 425: Lecture 10 Basics of Skeletal Animation and Kinematics

Scale Invariant Feature Transform (SIFT) CS 763 Ajit Rajwade

Image Warping. Some slides from Steve Seitz

Pen Tool, Fill Layers, Color Range, Levels Adjustments, Magic Wand tool, and shadowing techniques

Image Transformations

CS451Real-time Rendering Pipeline

Photo by Carl Warner

Today. The Graphics Pipeline: Projective Transformations. Last Week: Schedule. XForms Forms Library. Questions?

Computer Graphics. Jeng-Sheng Yeh 葉正聖 Ming Chuan University (modified from Bing-Yu Chen s slides)

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Textured Image Based Painterly Rendering Under Arbitrary Lighting

20 Calculus and Structures

CPSC 314, Midterm Exam. 8 March 2013

Perspective Projection Transformation

Lines and Their Slopes

Uses of Transformations. 2D transformations Homogeneous coordinates. Transformations. Transformations. Transformations. Transformations and matrices

Transcription:

Computer Graphics Si Lu Fall 27 http://www.cs.pd.edu/~lusi/cs447/cs447_547_comput er_graphics.htm //27

Last time Filtering Resampling 2

Toda Compositing NPR 3D Graphics Toolkits Transformations 3

Demo https://www.outube.com/watch?v=ckjf qnuso https://www.outube.com/watch?v=dklba U_uWpI 4

Compositing Compositing combines components from two or more images to make a new image Special effects are easier to control when done in isolation Even man all live-action sequences are more safel shot in different laers 5

Historicall The basis for film special effects Create digital imager and composite it into live action It was necessar for films (like Star Wars) where models were used It was done with film and masks, and was time consuming and epensive Important part of animation even hand animation Background change more slowl than foregrounds, so composite foreground elements onto constant background It was a major advance in animation the multiplane camera first used in Snow White (937) 6

Perfect Storm 7

Animated Eample over = 8

Mattes A matte is an image that shows which parts of another image are foreground objects Term dates from film editing and cartoon production How would I use a matte to insert an object into a background? How are mattes usuall generated for television? 9

Working with Mattes To insert an object into a background Call the image of the object the source Put the background into the destination For all the source piels, if the matte is white, cop the piel, otherwise leave it unchanged To generate mattes: Use smart selection tools in Photoshop or similar The outline the object and convert the outline to a matte Blue Screen: Photograph/film the object in front of a blue background, then consider all the blue piels in the image to be the background

Compositing Compositing is the term for combining images, one over the other Used to put special effects into live action

Alpha Basic idea: Encode opacit information in the image Add an etra channel, the alpha channel, to each image For each piel, store R, G, B and Alpha alpha = implies full opacit at a piel alpha = implies completel clear piels There are man interpretations of alpha Is there anthing in the image at that point (web graphics) Transparenc (real-time OpenGL) Images are now in RGBA format, and tpicall 32 bits per piel (8 bits for alpha) All images in the project are in this format 2

Pre-Multiplied Alpha Instead of storing (R,G,B,), store (R,G,B,) The compositing operations in the net several slides are easier with pre-multiplied alpha To displa and do color conversions, must etract RGB b dividing out = is alwas black Some loss of precision as gets small, but generall not a big problem 3

Compositing Assumptions We will combine two images, f and g, to get a third composite image Both images are the same size and use the same color representation Multiple images can be combined in stages, operating on two at a time 4

Basic Compositing Operation At each piel, combine the piel data from f and the piel data from g with the equation: c o Fc f Gc g F and G describe how much of each input image survives, and c f and c g are pre-multiplied piels, and all four channels are calculated To define a compositing operation, define F and G 5

Basic Compositing Operation F and G are simple functions of the alpha values c o F f, g c f G f, g c g F and G are chosen (independentl) Different choices give different operations To code it, ou can write one compositor and give it 6 numbers (3 for F, 3 for G) to sa which function Constant of or f is multiplied b -, or. Similar for g f g f g,,,,,,,,,,,, 6

Sample Images Images Alphas 7

Sample Images Images RGB,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Alphas.5.5.5.5.5.5 8

Sample Images Images Pre-multiplied RGBA,,,,,.5,.5,.5,.5,,,,,,.5,,.5,,.5,,.5,,.5,,.5,,,.5,.5,,,,,,,, Alphas 9

Over Operator Computes composite with the rule that f covers g F G f c Fc Gc c ( ) c o f g f f g 2

Over Operator c Fc Gc c ( ) c o f g f f g,,,.5,.5,,,,,,,,,,.5,.5,,,,,,.5,.5,, Over.5,,.5.5,,.5.5,,.5,,.25,.5,.75.5,,.5,,,.5,.5,,,,,,,,,,,.5,.5,, f g result 2

Over Operator: Etract RGB Color,,.5,.5,,,,,,,,,.5,.5,.25,.5,.75,.5,.5,,.5,,.5,, Pre-multiplied RGBA,, /3,2/3,,,,,,,,,,,,,,, RGB.5,.5,.25,.5,.75,.5,.5,,.5,,.5,, Alpha 22

Over Operator If there s some f, get f, otherwise get g over = 23

Inside Operator Computes composite with the rule that onl parts of f that are inside g contribute F G g 24

Inside Operator c o Fc f Gc g c g f,,,.5,.5,,,,,,,,,,,.5,.5,,,,,.5,.5,, Over.5,,.5.5,,.5.5,,.5,.5,.5,.25,.25,,,,,.5,.5,,,,,,,,,,,,,, f g result 25

Inside Operator Get f to the etent that g is there, otherwise nothing inside = 26

Outside Operator Computes composite with the rule that onl parts of f that are outside g contribute F G g 27

Outside Operator Get f to the etent that g is not there, otherwise nothing outside = 28

Atop Operator Computes composite with the ove rule but restricted to places where there is some g F G g f 29

Atop Operator Get f to the etent that g is there, otherwise g atop = 3

Xor Operator Computes composite with the rule that f contributes where there is no g, and g contributes where there is no f F G g f 3

Xor Operator Get f to the etent that g is not there, and g to etent of no f or = 32

Clear Operator Computes a clear composite F G Note that (,,,>) is a partiall opaque black piel, whereas (,,,) is full transparent, and hence has no color 33

Set Operator Computes composite b setting it to equal f F G Copies f into the composite 34

Compositing Operations F and G describe how much of each input image survives, and c f and c g are pre-multiplied piels, and all four channels are calculated c o Fc f Gc g Operation F G Over Inside Outside Atop Xor Clear Set g f g g g f f 35

Unar Operators Darken: Makes an image darker (or lighter) without affecting its opacit darken( f, ) ( rf, g f, bf, f ) Dissolve: Makes an image transparent without affecting its color dissolve ( f, ) ( rf, g f, bf, f ) 36

PLUS Operator Computes composite b simpl adding f and g, with no overlap rules c o Useful for defining cross-dissolve in terms of compositing: c f c g cross( f, g, t) dissolve ( f, t) plus dissolve ( g, t) 37

Obtaining Values Hand generate (paint a grascale image) Automaticall create b segmenting an image into foreground background: Blue-screening is the analog method Remarkabl comple to get right Lasso is the Photoshop operation With snthetic imager, use a special background color that does not occur in the foreground Brightest blue or green is common 38

Compositing With Depth Can store piel depth instead of alpha Then, compositing can trul take into account foreground and background Generall onl possible with snthetic imager Image Based Rendering is an area of graphics that, in part, tries to composite photographs taking into account depth 39

Toda More Compositing Non-photorealistic Rendering (NPR) 3D Graphics Toolkits Transformations 4

Painterl Filters Man methods have been proposed to make a photo look like a painting Toda we look at one: Painterl-Rendering with Brushes of Multiple Sizes* Basic ideas: Build painting one laer at a time, from biggest to smallest brushes At each laer, add detail missing from previous laer 4 *Aaron Hertzmann. Painterl rendering with curved brush strokes of multiple sizes, SIGGRAPH 998

Algorithm function paint(sourceimage,r... R n ) // take source and several brush sizes { canvas := a new constant color image // paint the canvas with decreasing sized brushes for each brush radius R i, from largest to smallest do { // Appl Gaussian smoothing with a filter of size const * radius // Brush is intended to catch features at this scale referenceimage = sourceimage * G(fs R i ) // Paint a laer paintlaer(canvas, referenceimage, Ri) } return canvas } 42

Algorithm 2 procedure paintlaer(canvas,referenceimage, R) // Add a laer of strokes { S := a new set of strokes, initiall empt D := difference(canvas,referenceimage) // euclidean distance at ever piel for = to imagewidth stepsize grid do // step in size that depends on brush radius for = to imageheight stepsize grid do { // sum the error near (,) M := the region (-grid/2..+grid/2, -grid/2..+grid/2) areaerror := sum(d i,j for i,j in M) / grid 2 if (areaerror > T) then { // find the largest error point } (,) := ma D i,j in M s :=makestroke(r,,,referenceimage) add s to S } } paint all strokes in S on the canvas, in random order 43

Point Stle Uses round brushes We provide a routine to paint round brush strokes into an image for the project 44

Results Original Biggest brush Medium brush added Finest brush added 45

Where to now We are now done with images We will spend several weeks on the mechanics of 3D graphics Coordinate sstems and Viewing Clipping Drawing lines and polgons Lighting and shading 46

Graphics Toolkits Graphics toolkits tpicall take care of the details of producing images from geometr Input (via API functions): Where the objects are located and what the look like Where the camera is and how it behaves Parameters for controlling the rendering Functions (via API): Perform well defined operations based on the input environment Output: Piel data in a framebuffer an image in a special part of memor Data can be put on the screen Data can be read back for processing (part of toolkit) 47

OpenGL OpenGL is an open standard graphics toolkit Derived from SGI s GL toolkit Provides a range of functions for modeling, rendering and manipulating the framebuffer What makes a good toolkit? Alternatives: Direct3D, Java3D - more comple and less well supported 48

A Good Toolkit Everthing is a trade-off Functionalit Compact: a minimal set of commands Orthogonal: commands do different things and can be combined in a consistent wa Speed Ease-of-Use and Documentation Portabilit Etensibilit Standards and ownership Not an ehaustive list 49

Coordinate Sstems The use of coordinate sstems is fundamental to computer graphics Coordinate sstems are used to describe the locations of points in space, and directions in space Multiple coordinate sstems make graphics algorithms easier to understand and implement 5

Coordinate Sstems (2) Different coordinate sstems represent the same point in different was v (2,3) v (,2) u u 5

Transformations Transformations convert points between coordinate sstems v (2,3) u=- v=- v (,2) u =u+ =v+ u 52

Transformations (Alternate Interpretation) Transformations modif an object s shape and location in one coordinate sstem (2,3) =- =- (,2) = + = + The previous interpretation is better for some problems, this one is better for others 53

2D Translation Moves an object 54?????? b b?

2D Translation Moves an object 55 b b b b

2D Scaling Resizes an object in each dimension 56 s s??????

2D Scaling Resizes an object in each dimension 57 s s s s

2D Rotation Rotate counter-clockwise about the origin b an angle 58??????

2D Rotation Rotate counter-clockwise about the origin b an angle 59 cos sin sin cos

X-Ais Shear Shear along ais (What is the matri for ais shear?) 6??????

X-Ais Shear Shear along ais (What is the matri for ais shear?) 6 sh

Reflect About X Ais?????? 62

Reflect About X Ais 63

2D Affine Transformations An affine transformation is one that can be written in the form: 64 b b a a a a b a a b a a or

Composition of Affine Transforms An affine transformation can be composed as a sequence of simple transformations: Translation Scaling (possibl with negative values) Rotation 65

Rotating About An Arbitrar Point What happens when ou rotate an object about an arbitrar point that is not the origin?

Rotating About An Arbitrar Point What happens when ou rotate an object about an arbitrar point that is not the origin?

How Do We Compute It? How do we rotate an about an arbitrar point? Hint: we know how to rotate about the origin of a coordinate sstem

Rotating About An Arbitrar Point (a, b) (, ) (a, b) (, )

Rotating About An Arbitrar Point Sa ou wish to rotate about the point (a,b) You know how to rotate about (,) Translate so that (a,b) is at (,) = a, = b Rotate =(-a)cos-(-b)sin, =(-a)sin+(-b)cos Translate back again f = +a, f = +b

Rotating About An Arbitrar Point Sa R is the rotation matri to appl, and p is the point about which to rotate Translation to Origin: Rotation: Translate back: p R R( p) p R R Rp Rp The translation component of the composite transformation involves the rotation matri. What a mess! p 7

Net Time Composing transformations 3D Transformations Viewing 72