University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 6, Fri 10 Oct 2003 sampling.

Slides:



Advertisements
Similar presentations
Sampling, Aliasing.
Advertisements

Sampling and Reconstruction
Computer Vision Lecture 7: The Fourier Transform
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing.
3-D Computational Vision CSc Image Processing II - Fourier Transform.
DFT/FFT and Wavelets ● Additive Synthesis demonstration (wave addition) ● Standard Definitions ● Computing the DFT and FFT ● Sine and cosine wave multiplication.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
Chap 4 Image Enhancement in the Frequency Domain.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
MIT EECS 6.837, Durand and Cutler Sampling, Aliasing, & Mipmaps.
CS 551 / CS 645 Antialiasing. 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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Advanced Rendering II,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations II Week.
Sampling, Aliasing, & Mipmaps
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Scan Conversion Week 6, Wed 8 Oct 2003
CS5520 Image-Based Rendering © Chun-Fa Chang, Spring 2003 Sampling Theorem & Antialiasing April 15, 2003.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 4 Image Enhancement in the Frequency Domain Chapter.
Sampling and Antialiasing CMSC 491/635. Abstract Vector Spaces Addition –C = A + B = B + A –(A + B) + C = A + (B + C) –given A, B, A + X = B for only.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 3 Ravi Ramamoorthi
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
Echivalarea sistemelor analogice cu sisteme digitale Prof.dr.ing. Ioan NAFORNITA.
G52IIP, School of Computer Science, University of Nottingham 1 Image Transforms Fourier Transform Basic idea.
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
Topic 7 - Fourier Transforms DIGITAL IMAGE PROCESSING Course 3624 Department of Physics and Astronomy Professor Bob Warwick.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Image Synthesis Rabie A. Ramadan, PhD 3. 2 Our Problem.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
Image Processing © 2002 R. C. Gonzalez & R. E. Woods Lecture 4 Image Enhancement in the Frequency Domain Lecture 4 Image Enhancement.
Filtering Robert Lin April 29, Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Lecture 7: Sampling Review of 2D Fourier Theory We view f(x,y) as a linear combination of complex exponentials that represent plane waves. F(u,v) describes.
October 29, 2013Computer Vision Lecture 13: Fourier Transform II 1 The Fourier Transform In the previous lecture, we discussed the Hough transform. There.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
Leo Lam © Signals and Systems EE235 Leo Lam.
2D Sampling Goal: Represent a 2D function by a finite set of points.
Sampling Theorem & Antialiasing
Fourier Transform.
Lecture 5: Fourier and Pyramids
2D Fourier Transform.
Digital Image Processing Image Enhancement in Spatial Domain
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
The Fourier Transform.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Fourier Transform (Chapter 4) CS474/674 – Prof. Bebis.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Sampling and Reconstruction.
Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)
Digital Image Processing Lecture 8: Fourier Transform Prof. Charlene Tsai.
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics
Distributed Ray Tracing
Image Enhancement in the
Sampling Theorem & Antialiasing
(C) 2002 University of Wisconsin, CS 559
Dr. Nikos Desypris, Oct Lecture 3
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F() is the spectrum of the function.
Fundamentals Data.
Joshua Barczak CMSC435 UMBC
CSCE 643 Computer Vision: Image Sampling and Filtering
CSCE 643 Computer Vision: Thinking in Frequency
Distributed Ray Tracing
Basic Image Processing
Presentation transcript:

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 6, Fri 10 Oct 2003 sampling

Week 6, Fri 10 Oct 03 © Tamara Munzner2 News project 1 –solution today –hall of fame next week great work!! extra office hours –Fri usual, 11-1:30 extra lab hours –Mon 10/13 no class, no office hours –Tue 11-1 extra lab hours, 4-5:30 my office hours rescheduled (FSC2618)

Week 6, Fri 10 Oct 03 © Tamara Munzner3 News Office hours reminder: FSC 2618 –Mondays 10:30-11:30 or by appointment –exceptions: Oct 20, Nov 10 Readings –Chap , Fri 10/3 slide notes

Week 6, Fri 10 Oct 03 © Tamara Munzner4 Barycentric Coordinates recap weighted combination of vertices (1,0,0) (0,1,0) (0,0,1) “convex combination of points” of points”

Week 6, Fri 10 Oct 03 © Tamara Munzner5 Transforming Normals nonuniform scaling does not work x-y=0 plane –line x=y –normal: [1,-1,0] ignore normalization for now

Week 6, Fri 10 Oct 03 © Tamara Munzner6 apply nonuniform scale: stretch along x by 2 –new plane x = 2y transformed normal 2x – y = 0 (2x=y) –not perpendicular! Transforming Normals should be x-2y=0 (x = 2y)

Week 6, Fri 10 Oct 03 © Tamara Munzner7 Finding Correct Normal Transform transform a plane if we know M, what should Q be? stay perpendicular substitute from above thus the normal to any surface has to be transformed by the inverse transpose of the modelling transformation true if

University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 8 Sampling and Antialiasing

Week 6, Fri 10 Oct 03 © Tamara Munzner9 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 discrete function to a continuous one is called reconstruction the process of mapping a continuous variable to a discrete one is called quantization rendering an image requires sampling and quantization displaying an image involves reconstruction

Week 6, Fri 10 Oct 03 © Tamara Munzner10 Displays  Signal Reconstruction All physical displays recreate a continuous image from a discrete sampled image by using a finite sized source of light for each pixel. Reconstruction Discrete input values.Continuous Light Output.

Week 6, Fri 10 Oct 03 © Tamara Munzner11 Imaging Devices Area Sample video camera : CCD array. Regular array of imaging sensors. y x Value sensed is an area integral over a pixel. Intensity, I

Week 6, Fri 10 Oct 03 © Tamara Munzner12 Imaging Devices Area Sample eye : photoreceptors J. Liang, D. R. Williams and D. Miller, "Supernormal vision and high- resolution retinal imaging through adaptive optics," J. Opt. Soc. Am. A 14, (1997) Film is similar : irregular array of receptors.

Week 6, Fri 10 Oct 03 © Tamara Munzner13 Slide © Rosalee Nerheim-Wolfe Continuous Luminosity Signal

Week 6, Fri 10 Oct 03 © Tamara Munzner14 Slide © Rosalee Nerheim-Wolfe Sampled Luminosity

Week 6, Fri 10 Oct 03 © Tamara Munzner15 Slide © Rosalee Nerheim-Wolfe Reconstructed Luminosity

Week 6, Fri 10 Oct 03 © Tamara Munzner16 Slide © Rosalee Nerheim-Wolfe Reconstruction Artefact

Week 6, Fri 10 Oct 03 © Tamara Munzner17 Bad Solution for Jaggies Removed the jaggies, but also all the detail !  Reduction in resolution blurring final image

Week 6, Fri 10 Oct 03 © Tamara Munzner18 Line Segments we tried to sample a line segment so it would map to a 2D raster display we quantized the pixel values to 0 or 1 we saw stair steps, or jaggies

Week 6, Fri 10 Oct 03 © Tamara Munzner19 Line Segments instead, quantize to many shades but what sampling algorithm is used?

Week 6, Fri 10 Oct 03 © Tamara Munzner20 Area Sampling shade pixels according to the area covered by thickened line this is unweighted area sampling a rough approximation formulated by dividing each pixel into a finer grid of pixels

Week 6, Fri 10 Oct 03 © Tamara Munzner21 Unweighted Area Sampling primitive cannot affect intensity of pixel if it does not intersect the pixel equal areas cause equal intensity, regardless of distance from pixel center to area

Week 6, Fri 10 Oct 03 © Tamara Munzner22 Weighted Area Sampling unweighted sampling colors two pixels identically when the primitive cuts the same area through the two pixels intuitively, pixel cut through the center should be more heavily weighted than one cut along corner

Week 6, Fri 10 Oct 03 © Tamara Munzner23 Weighted Area Sampling weighting function, W(x,y) –specifies the contribution of primitive passing through the point (x, y) from pixel center x Intensity W(x,y)

Week 6, Fri 10 Oct 03 © Tamara Munzner24 Images an image is a 2D function I (x, y) that specifies intensity for each point (x, y)

Week 6, Fri 10 Oct 03 © Tamara Munzner25 Sampling and Image our goal is to convert the continuous image to a discrete set of samples the graphics system’s display hardware will attempt to reconvert the samples into a continuous image: reconstruction

Week 6, Fri 10 Oct 03 © Tamara Munzner26 Point Sampling an Image simplest sampling is on a grid sample depends solely on value at grid points

Week 6, Fri 10 Oct 03 © Tamara Munzner27 Point Sampling multiply sample grid by image intensity to obtain a discrete set of points, or samples. Sampling Geometry

Week 6, Fri 10 Oct 03 © Tamara Munzner28 some objects missed entirely, others poorly sampled Sampling Errors

Week 6, Fri 10 Oct 03 © Tamara Munzner29 Fixing Sampling Errors supersampling –take more than one sample for each pixel and combine them how many samples is enough? how do we know no features are lost? 150x15 to 100x10 200x20 to 100x10 300x30 to 100x10 400x40 to 100x10

Week 6, Fri 10 Oct 03 © Tamara Munzner30 Spectral/Fourier Analysis spectral representation treats the function as a weighted sum of sines and cosines every function has two representations – spatial (time) domain - normal representation – frequency domain - spectral representation Fourier transform converts between the spatial and frequency domains.

Week 6, Fri 10 Oct 03 © Tamara Munzner31 Spatial Domain image as spatial signal Examples from Foley, van Dam, Feiner, and Hughes Pixel position across scanline Intensity

Week 6, Fri 10 Oct 03 © Tamara Munzner32 Spatial Frequency in time - cycles per second in space - cycles per meter, degree, etc. Fourier view: sum of signals –pick frequency, phase shift –familiar example: sound spectrum

Week 6, Fri 10 Oct 03 © Tamara Munzner33 Summing Waves I

Week 6, Fri 10 Oct 03 © Tamara Munzner34 Summing Waves II represent spatial signal as sum of sine waves (varying frequency and phase shift) very commonly used to represent sound “spectrum”

Week 6, Fri 10 Oct 03 © Tamara Munzner35 Waves as Frequencies

Week 6, Fri 10 Oct 03 © Tamara Munzner36 Frequency Domain height represents strength of each frequency –sine wave: impulse –square wave: infinite train of impulses

Week 6, Fri 10 Oct 03 © Tamara Munzner37 Spectral/Fourier Analysis Fourier transform converts between the spatial and frequency domain Euler formula : –real and imaginary components forward and reverse transforms very similar –reversal in sign of imaginary component, scale constant Spatial domain Frequency domain.

Week 6, Fri 10 Oct 03 © Tamara Munzner38 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)

Week 6, Fri 10 Oct 03 © Tamara Munzner39 Fourier Transform Example spatial domain frequency domain

Week 6, Fri 10 Oct 03 © Tamara Munzner40

Week 6, Fri 10 Oct 03 © Tamara Munzner41 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 - Claude Shannon

Week 6, Fri 10 Oct 03 © Tamara Munzner42 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

Week 6, Fri 10 Oct 03 © Tamara Munzner43 Falling Below Nyquist Rate when sampling below Nyquist Rate, resulting signal looks like a lower- frequency one –this is aliasing!

Week 6, Fri 10 Oct 03 © Tamara Munzner44 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 –facilitates reconstruction –avoids Nyquist Limit mistakes

Week 6, Fri 10 Oct 03 © Tamara Munzner45 Falling Below Nyquist Rate when sampling below Nyquist Rate, resulting signal looks like a lower-frequency one –safe with band-limits, guarantee that samples are not derived from signal of higher frequency

Week 6, Fri 10 Oct 03 © Tamara Munzner46 Flaws with Nyquist Rate samples may not align with peaks

Week 6, Fri 10 Oct 03 © Tamara Munzner47 Filtering low pass high pass

Week 6, Fri 10 Oct 03 © Tamara Munzner48 Filtering to lower Nyquist rate, remove high frequencies from image: low-pass filter –only low frequencies remain: band-limited

Week 6, Fri 10 Oct 03 © Tamara Munzner49 Filtering in Space Domain blurring or averaging pixels together. Calculate integral of one function, f(x) by a sliding second function g(x-y). Known as Convolution. g(y) Increment x h(x) Integrate over y f(x)

Week 6, Fri 10 Oct 03 © Tamara Munzner50 Filtering in Frequency Domain Image Frequency domain FilterImage Fourier Transform Fourier Transform Lowpass filter Highpass filter multiply signal’s spectrum by pulse function

Week 6, Fri 10 Oct 03 © Tamara Munzner51 Filtering sinc (pulse) function is common filter: –sinc(x) = sin (  x)/  x Spatial Domain Frequency Domain

Week 6, Fri 10 Oct 03 © Tamara Munzner52 Sinc Filter Slide filter along spatial domain and compute new pixel value that results from convolution

Week 6, Fri 10 Oct 03 © Tamara Munzner53 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)

Week 6, Fri 10 Oct 03 © Tamara Munzner54 Sampling in Frequency Domain remember, sampling was defined as multiplying a grid of delta functions by the continuous image called a convolution in spatial domain sampling grid function being sampled

Week 6, Fri 10 Oct 03 © Tamara Munzner55 Sampling Multiplication of the sample with a regular train of delta functions.

Week 6, Fri 10 Oct 03 © Tamara Munzner56 Convolution This amounts to accumulating copies of the function’s spectrum sampled at the delta functions of the sampling grid

Week 6, Fri 10 Oct 03 © Tamara Munzner57 Convolution theorem. Theorem: Multiplication in the frequency domain is equivalent to convolution in the space domain. Symmetric Theorem: Multiplication in the space domain is equivalent to convolution in the frequency domain.

Week 6, Fri 10 Oct 03 © Tamara Munzner58 Bilinear Filter sometimes called a tent filter easy to compute –just linearly interpolate between samples finite extent and no negative values still has artifacts

Week 6, Fri 10 Oct 03 © Tamara Munzner59 Sampling Pipeline

Week 6, Fri 10 Oct 03 © Tamara Munzner60 Sampling Pipeline