CS 445 / 645 Introduction to Computer Graphics Lecture 19

advertisement

CS 445 / 645

Introduction to Computer Graphics

Lecture 19

Assign 3 and Antialiasing

Points Back

If you got #10 wrong

– you get 2 points out of 4

– put your test in the envelope on my office door

Assignment 3 - Morphing

How do we explain this?

Step 1 – Interpolate endpoints

Interpolate between lines XP and X’-P’

F

2

(0,0)

S

1

S

2

I

1

½ S

1+

½ F

1

(0,0)

F

1

How would start image morph?

What is color from start image at circle in intermediate image?

F

2

I

2

(0,0)

S

1

S

2 I

1

(0,0)

F

1

Build Common Coordinate System

Find projection

F

2

X

I

2 u = (X – I

1

).dot.(I

2

– I

1

) / || I

2

– I

1

) ||

(0,0)

S

1 u

S

2 I

1

(0,0)

F

1

Find Projection

Build Common Coordinate System

Find projection on perpendicular

F

2

X

I

2 v

(0,0)

S

1

S

2 I

1

(0,0)

F

1 v = (X – I

1

).dot.Perp(I

|| I

2

– I

1

) ||

2

– I

1

)

Sample color from initial image

(0,0)

S

1

X=(u,v)

S

2 I

1

X=(u,v)

I

2

(0,0)

F

2

F

1

Repeat for all pixels in image

(0,0)

S

1 u

S

2

I

2

I

1

(0,0)

F

2

F

1

Now do the same thing for the final image

(0,0)

S

1 u

S

2

I

2

I

1

(0,0)

F

2

F

1

Now do a 50/50 blend of two morphed images

Final Movie

Extra factors…

What about more than one line?

S

3

S

4

I

4

F

4

I

2

(0,0)

S

1

S

2

I

3

I

1

F

3

(0,0)

F

1

F

2

More than one line

Compute pixel color from initial image for each line and average (weighted)

F

2

S

3

(0,0)

S

1

S

2

S

4

I

3

I

1

I

4

F

4

I

2

F

3

(0,0)

F

1

More than one line

What is a pixel?

A pixel is not…

• A box

• A disk

A teeny tiny little light

A pixel is a point

• It has no dimension

It occupies no area

• It cannot be seen

• It can have a coordinate

A pixel is more than a point, it is a sample

Samples

Most things in the real world are continuous

Everything in a computer is discrete

The process of mapping a continuous function to a discrete one is called sampling

The process of mapping a continuous variable to a discrete one is called quantization

Rendering an image requires sampling and quantization

Samples

Samples

GeForce3 - Multisampling

• 4x Supersample Multisampling

Point Sampling an Image

Simplest sampling is on a grid

Sample depends solely on value at grid points

Point Sampling

Multiply sample grid by image intensity to obtain a discrete set of points, or samples.

Sampling Geometry

Signal Theory

Convert spatial signal to frequency domain

Pixel position across scanline

Example from Foley, van Dam, Feiner, and Hughes

Signal Theory

Represent spatial signal as sum of sine waves

(varying frequency and phase shift)

Very commonly used to represent sound “spectrum”

Fourier Analysis

Convert spatial domain to frequency domain

• Let f(x) indicate the intensity at a location in space, x (pixel value)

• u is a complex number representing frequency and phase shift

– i = sqrt (-

1) … frequently not plotted

• F(u) is the amplitude of a particular frequency in a signal

– In this case the signal is f(x)

Fourier Transform

Examples of spatial and frequency domains

Nyquist Sampling Theorem

The ideal samples of a continuous function contain all the information in the original function if and only if the continuous function is sampled at a frequency greater than twice the highest frequency in the function

Nyquist Rate

The lower bound on the sampling rate equals twice the highest frequency component in the image’s spectrum

This lower bound is the Nyquist Rate

Band-limited Signals

If you know a function contains no components of

frequencies higher than x

• Band-limited implies original function will not require any ideal functions with frequencies greater than x

• This facilitates reconstruction

Flaws with Nyquist Rate

Samples may not align with peaks

Flaws with Nyquist Rate

When sampling below Nyquist Rate, resulting signal looks like a lower-frequency one

• With no knowledge of band-limits, samples could have been derived from signal of higher frequency

Low-pass Filtering

A way to eliminate high frequencies from an image

• In the frequency domain

– Multiply signal’s spectrum by pulse function

– Example on board

• A way to band limit an image

• Multiplying two Fourier Transforms is useful - convolution

Convolution

Multiplying two Fourier Transforms (F(u)G(u)) in the frequency domain == convolution (represented as *) on their inverse Fourier transforms in the spatial domain f(x) * g(x) = h(x)

• Take the filter function, g(x) and center it at x

• Take a weighted average of f(x) in the neighborhood of x

– Weighting defined by g(x)

Filtering

To lower Nyquist rate, remove high frequencies from image: low-pass filter

• Only low frequencies remain

Sinc (pulse) function is common filter:

• sinc(x) = sin ( p x)/ p x

Spatial Domain Frequency Domain

Sinc Filter

Slide filter along spatial domain and compute new pixel value that results from convolution

Bilinear Filter

Sometimes called a tent filter

Easy to compute

• just linearly interpolate between samples

Finite extent and no negative values

Still has artifacts

Sampling Pipeline

Sampling in the Frequency Domain

Remember, sampling was defined as multiplying a grid of delta functions by the continuous image

This is called a convolution in spatial domain

The sampling grid

The function being sampled

Convolution

This amounts to accumulating copies of the function’s spectrum sampled at the delta functions of the sampling grid

Download