Sampling, Aliasing.

Slides:



Advertisements
Similar presentations
Sampling and Reconstruction
Advertisements

Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Antialiasing Antialiasing.
David Luebke 1 4/28/2015 Aliasing & Antialiasing.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
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.
Aliasing & Antialiasing
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi Some slides.
Sampling, Aliasing, & Mipmaps
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CSCE 641 Computer Graphics: Fourier Transform Jinxiang Chai.
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.
Fourier Theory and its Application to Vision
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
Computational Photography: Fourier Transform Jinxiang Chai.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Image Sampling Moire patterns -
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
CSC418 Computer Graphics n Aliasing n Texture mapping.
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
Filtering theory: Battling Aliasing with Antialiasing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CS 431/636 Advanced Rendering Techniques
© 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.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Antialiasing CptS 548 Advanced Computer Graphics John C. Hart.
David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
MIT EECS Sampling and Monte-Carlo Integration.
IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction
01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Digital image processing Chapter 3. Image sampling and quantization IMAGE SAMPLING AND IMAGE QUANTIZATION 1. Introduction 2. Sampling in the two-dimensional.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
MIT EECS Sampling, Aliasing, & Mipmaps. MIT EECS Last Time? Global illumination “physically accurate light transport” The rendering equation.
Sampling Pixel is an area!! – Square, Rectangular, or Circular? How do we approximate the area? – Why bother? Color of one pixel Image Plane Areas represented.
Sampling Theorem & Antialiasing
(c) 2002 University of Wisconsin, CS 559
1 Dr. Scott Schaefer Antialiasing. 2/70 What is aliasing?
Projects Project 1a due this Friday Project 1b will go out on Friday to be done in pairs start looking for a partner now.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
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)
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics
Image Resampling & Interpolation
Distributed Ray Tracing
Sampling Theorem & Antialiasing
Sampling and Antialiasing
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.
Sampling Theorem told us …
Joshua Barczak CMSC435 UMBC
لجنة الهندسة الكهربائية
CSCE 643 Computer Vision: Image Sampling and Filtering
CSCE 643 Computer Vision: Thinking in Frequency
Sampling and Reconstruction
Distributed Ray Tracing
Linear filtering.
CSC418 Computer Graphics Aliasing Texture mapping.
Distributed Ray Tracing
Presentation transcript:

Sampling, Aliasing

Examples of Aliasing

What is a Pixel? A pixel is not: a box a disk a tiny little light A pixel “looks different” on different display devices A pixel is a sample it has no dimension it occupies no area it cannot be seen it has a coordinate it has a value

Philosophical perspective The physical world is continuous, inside the computer things need to be discrete Lots of computer graphics is about translating continuous problems into discrete solutions e.g. ODEs for physically-based animation, global illumination, meshes to represent smooth surfaces, antialiasing Careful mathematical understanding helps do the right thing

More on Samples 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 To represent or render an image using a computer, we must both sample and quantize Focus on the effects of sampling and how to overcome them discrete value discrete position

Sampling & reconstruction The visual array of light is a continuous function 1/ we sample it with a digital camera, or with a ray tracer This gives us a finite set of numbers, not really something we can see We are now inside the discrete computer world 2/ we need to get this back to the physical world: we reconstruct a continuous function for example, the point spread of a pixel on a CRT or LCD Both steps can create problems But we’ll focus on the first one (you are not display manufacturers)

Examples of Aliasing

Examples of Aliasing

Examples of Aliasing Texture Errors point sampling

Sampling Density If we’re lucky, sampling density is enough Input Reconstructed

Sampling Density If we insufficiently sample the signal, it may be mistaken for something simpler during reconstruction (that's aliasing!)

Aliasing insufficient sampling (sampling rate is too small) Aliasing: a high-frequency signal masquerading as a low frequency Actual (high-frequency) signal Sampling Interval Sampled (aliased) signal

Discussion Two types of aliasing Edges Repetitive textures More tricky Harder to solve

Solution? How do we avoid the high-frequency patterns distort our image? We blur! For ray tracing: compute at higher resolution, blur, resample at lower resolution For textures, we can also blur the texture image before doing the lookup

Aliasing and Line Drawing We draw lines by sampling at intervals of one pixel and drawing the closest pixels Results in stair-stepping Sampling Interval Sampling Interval

Anti-aliasing Lines Idea: Make line thicker Fade line out (removes high frequencies) Now sample the line

Anti-aliasing Lines Solution – Unweighted Area Sampling: Treat line as a single-pixel wide rectangle Colour pixels according to the percentage of each pixel covered by the rectangle.

Solution : Unweighted Area Sampling Pixel area is unit square Constant weighting function Pixel colour is determined by computing the amount of the pixel covered by the line, then shading accordingly Easy to compute, gives reasonable results One Pixel Line

Solution : Weighted Area Sampling Treat pixel area as a circle with a radius of one pixel Use a radially symmetric weighting function (e.g., cone): Areas closer to the pixel centre are weighted more heavily Better results than unweighted, slightly higher cost One Pixel Line

Re-hashing Your intuitive solution is to compute multiple colour values per pixel and average them A better interpretation of the same idea is that You first create a higher resolution image You blur it (average) You resample it at a lower resolution

Sampling Theorem When sampling a signal at discrete intervals, the sampling frequency must be greater than twice the highest frequency of the input signal in order to be able to reconstruct the original perfectly from the sampled version (Shannon, Nyquist, Whittaker, Kotelnikov)

Filters (convolution kernel) Weighting function Area of influence often bigger than "pixel" Sum of weights = 1 Each sample contributes the same total to image Constant brightness as object moves across the screen. No negative weights

Filters Filters are used to reconstruct a continuous signal from a sampled signal (reconstruction filters) band-limit continuous signals to avoid aliasing during sampling (low-pass filters) Desired frequency domain properties are the same for both types of filters Often, the same filters are used as reconstruction and low-pass filters

Pre-Filtering Filter continuous primitives Treat a pixel as an area Compute weighted amount of object overlap What weighting function should we use?

Post-Filtering Filter samples Compute the weighted average of many samples Regular or jittered sampling (better)

The Ideal Filter Unfortunately it has infinite spatial extent Every sample contributes to every interpolated point Expensive/impossible to compute spatial frequency

Problems with Practical Filters Many visible artifacts in re-sampled images are caused by poor reconstruction filters Excessive pass-band attenuation results in blurry images Excessive high-frequency leakage causes "ringing" and can accentuate the sampling grid (anisotropy) frequency

Gaussian Filter This is what a CRT does for free! spatial frequency

Box Filter / Nearest Neighbour Pretending pixels are little squares. spatial frequency

Tent Filter / Bi-Linear Interpolation Simple to implement Reasonably smooth spatial frequency

Bi-Cubic Interpolation Begins to approximate the ideal spatial filter, the sinc function spatial frequency

Ideal sampling/reconstruction Pre-filter with a perfect low-pass filter Box in frequency Sinc in time Sample at Nyquist limit Twice the frequency cutoff Reconstruct with perfect filter Box in frequency, sinc in time And everything is great!

Difficulties with perfect sampling Hard to prefilter Perfect filter has infinite support Fourier analysis assumes infinite signal and complete knowledge Not enough focus on local effects And negative lobes Emphasizes the two problems above Negative light is bad Ringing artifacts if prefiltering or supports are not perfect

Supersampling in graphics Pre-filtering is hard Requires analytical visibility Then difficult to integrate analytically with filter Possible for lines, or if visibility is ignored usually, fall back to supersampling

Solution: Super-sampling Divide pixel up into “sub-pixels”: 22, 33, 44, etc. Sub-pixel is coloured if inside line Pixel colour is the average of its sub-pixel colours Easy to implement (in software and hardware) No anti-aliasing Anti-aliasing (22 super-sampling)

Many Types of Supersampling Grid Random Jittered Poisson Disc

Polygon Anti-aliasing To anti-alias a line, we treat it as a rectangle Anti-aliasing a polygon is similar. Some concerns: Micro-polygons: smaller than a pixel Super-sampling: There may still be polygons that “slip between the cracks”

Uniform supersampling Compute image at resolution k*width, k*height Downsample using low-pass filter (e.g. Gaussian, sinc, bicubic)

Uniform supersampling Advantage: The first (super)sampling captures more high frequencies that are not aliased Issues Frequencies above the (super)sampling limit are still aliased Works well for edges Not as well for repetitive textures

Jittering Uniform sample + random perturbation Sampling is now non-uniform Signal processing gets more complex In practice, adds noise to image But noise is better than aliasing Moiré patterns

Jittered supersampling Regular, Jittered Supersampling

Jittering Displaced by a vector a fraction of the size of the subpixel distance Low-frequency Moire (aliasing) pattern replaced by noise Extremely effective Patented by Pixar!

Reconsider Uniform supersampling Problem: supersampling only pushes the problem further: The signal is still not bandlimited Aliasing still happens We need a better solution for high frequency sections of the image

Adaptive sampling Adjust your sampling rate and/or bucket size on-the-fly, depending on results of previous samples attempt to concentrate more samples in high frequency areas (e.g., edges of objects) and fewer samples in low frequency areas (constant regions) get an approximate view of the function by first sampling with a low sampling rate and/or large bucket size over the entire domain then use that approximation to estimate where more samples should be taken by focusing on regions of high variance generally a recursive process Much better than naïve supersampling

Adaptive supersampling Use more sub-pixel samples around edges

Adaptive supersampling Use more sub-pixel samples around edges Compute colour at small number of sample If variance with neighbour pixels is high Compute larger number of samples

Adaptive supersampling Use more sub-pixel samples around edges Compute colour at small number of sample If variance with neighbour pixels is high Compute larger number of samples