Anti Aliasing Pre
-
Upload
rajaramang -
Category
Documents
-
view
239 -
download
0
Transcript of Anti Aliasing Pre
-
8/6/2019 Anti Aliasing Pre
1/22
Anti-Aliasing
-
8/6/2019 Anti Aliasing Pre
2/22
Aliasing
Aliasing definition: Distortion of information due to under-sampling
To avoid aliasing, sampling frequency has to be greaterthan twice the highest frequency occurring in the object.This minimum sampling frequency to avoid aliasing is alsocalled the Nyquist Sampling Frequency.
In other words, sample at least twice every period.
True Object
period
Sampling below Nyquist Freq
period
Sampling above Nyquist Freq
-
8/6/2019 Anti Aliasing Pre
3/22
Example of Aliasing
Suppose we have a pattern of alternating red and green stripes.
Suppose we have show this pattern with pixels matching the stripes. This
is equal to the Nyquist Frequency. For each pixel, we sample the middle
of the pixel and color the entire pixel that color. We get the correct image.
-
8/6/2019 Anti Aliasing Pre
4/22
Example of Aliasing(continued)
Suppose now we move the pattern further back, so that each pixel is nowrelatively bigger. Note: This is now below the Nyquist frequency. Once
again, we sample the middle of the pixel
And we color the entire pixel the sampled color. We would get this picture
This gives a severe misrepresentation of the underlying pattern.
-
8/6/2019 Anti Aliasing Pre
5/22
Anti-Aliasing
Since were representing real-worldobjects with a finite number of pixels,aliasing occurs frequently.
Therefore, we need to implementtechniques to cancel the undesirableeffects of aliasing.
These techniques are called anti-aliasingtechniques.
One common anti-aliasing method issuper-sampling
-
8/6/2019 Anti Aliasing Pre
6/22
Antialiasing Examples
-
8/6/2019 Anti Aliasing Pre
7/22
Super-Sampling
Split single pixel into sub-pixels.
Pixels final color is a mixture of sub-pixelscolors. Simple method: Sample at the middle ofeach sub-pixel. Then, pixels color is the averageof the sub-pixels color.
Pixels Sub-divide into sub-pixels
-
8/6/2019 Anti Aliasing Pre
8/22
-
8/6/2019 Anti Aliasing Pre
9/22
-
8/6/2019 Anti Aliasing Pre
10/22
Super-Sampling a Zero-Width Line
Apply Bresenhams
algorithm at sub-
pixel level
Sub-divide each pixel into
sub-pixels, for example 4x4
sub-pixels
Each pixel can have a maximum of 4
colored sub-pixels
How many sub-pixels are colored?
0 0 0 4
2 4 4 0
2 0 0 0
Assign color
Fraction of pixels color to be lines color
0.0 0.0 0.0 1.0
0.5 1.0 1.0 0.0
0.5 0.0 0.0 0.0
-
8/6/2019 Anti Aliasing Pre
11/22
Super-Sampling a Line with Non-Zero Width
A line that is one-pixel wide.
For every pixel: Maximum number of
sub-pixels inside line = 16
A sub-pixel is considered in if its lower-left
corner is inside the line
Fraction of sub-pixels are in = fraction of color of the pixel should be line color
0 0 5/16 9/16
10/16 15/16 13/16 7/16
8/16 2/16 0 0
-
8/6/2019 Anti Aliasing Pre
12/22
Sub-pixel Weighting Masks
Instead of considering each sub-pixel to be ofequal importance, assign a weight to each sub-pixel.
Usually consider the center sub-pixel to be mostimportant
1 2 2 1
2 3 3 2
2 3 3 2
1 2 2 1
Example weight for each sub-pixel
Total weight = 32
Final color of pixel = Sum of each (sub-pixel colors x sub-pixel weight) / total weight
-
8/6/2019 Anti Aliasing Pre
13/22
Common Filter Functions
Box Filter Cone Filter Gaussian Filter
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 2 3 2 1
2 4 5 4 2
3 5 6 5 3
2 4 5 4 2
1 2 3 2 1
1 2 3 2 1
2 5 6 5 2
3 6 8 6 3
2 5 6 5 2
1 2 3 2 1
Gaussian function = exp ( - )
where s is the standard deviation and m is the mean
1
s 2p
( x m )2
2s2
-
8/6/2019 Anti Aliasing Pre
14/22
-
8/6/2019 Anti Aliasing Pre
15/22
-
8/6/2019 Anti Aliasing Pre
16/22
-
8/6/2019 Anti Aliasing Pre
17/22
Additional Benefit of Anti-Aliasing
Solve the line-intensity difference problem.
The line-intensity difference occurs when weredrawing a diagonal line.
In the following example, 5 pixels are used to
draw each line, but the diagonal line is actuallylonger. Therefore, the diagonal line appears lessintense.
Applying anti-aliasing technique automaticallytakes care of this problem (assume anti-alias
non-zero width line).
-
8/6/2019 Anti Aliasing Pre
18/22
Anti-Aliasing Area Boundaries
For each pixel, determine whatfraction lines in one area, and whatfraction lies in the other area.
Then, take the weighted average ofthe two area colors.
Pitteway-Watkinson method adaptsBresenhams method to quickly findthe percentage.
-
8/6/2019 Anti Aliasing Pre
19/22
-
8/6/2019 Anti Aliasing Pre
20/22
-
8/6/2019 Anti Aliasing Pre
21/22
-
8/6/2019 Anti Aliasing Pre
22/22