View
240
Download
4
Category
Preview:
Citation preview
Graphics
cgvr.korea.ac.kr Graphics Lab @ Korea University
Raster Graphics
고려대학교 컴퓨터 그래픽스 연구실
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Contents
Display Hardware How are images display?
Raster Graphics Systems How are imaging system organized
Output Primitives How can we describe shapes with primitives?
Color Models How can we describe and represent colors?
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Bresenham’s Line Algorithm
Accurate and Efficient Use only incremental integer calculations Test the sign of an integer parameter
Case) Positive Slope Less Than 1 After the pixel (xk, yk) is displayed,
next which pixel is decided to plot
in column xk+1?
(xk+1, yk) or (xk+1, yk+1)
xk
yk
xk+1
yk+1
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Bresenham’s Algorithm(cont.)
Case) Positive Slope Less Than 1 y at sampling position xk
Difference
Decision parameter
xk
yk
xk+1
yk+1
bxmy k 1
kkk ybxmyyd 11
bxmyyyd kkk 1112
d1– d2 < 0 (xk+1, yk)
d1– d2 > 0 (xk+1, yk+1)
cyxxy
bxyyxxy
ddxp
kk
kk
k
22
1222221
d1
d2
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Bresenham’s Algorithm(cont.)
Case) Positive Slope Less Than 1 Decision parameter
Decision parameter of a starting pixel (x0, y0)
kkkk
kkkkkk
yyxxxy
cyxxycyxxypp
11
111
22
2222
kkkk yyxypp 11 22
xxbyxbxyxy
bxybmxxxy
bxyyxxyp
22222
12222
12222
00
00
000
xyp 20
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Bresenham’s Algorithm(cont.)
Algorithm for 0<m<1 Input the two line endpoints and store the left end point in (x0, y0)
Load (x0, y0) into the frame buffer; that is, plot the first point
Calculate constants Δx, Δy, 2Δy, and 2Δy− 2Δx, and obtain the starting value for the decision parameter as
At each xk along the line, start at k =0, perform the following test:
If pk < 0, the next point to plot is (xk+1, yk) and
Otherwise, the next point to plot is (xk+1, yk+1) and
Repeat step 4 Δx times
xyp 20
ypp kk 21
xypp kk 221
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Polygons
Filling Polygons Scan-line fill algorithm
Inside-Outside tests
Boundary fill algorithm
1 2 3 4 5 6 7 8 91 234
6 7 8 91011
5
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Scan-Line Polygon Fill
Topological Difference between 2 Scan lines y : intersection edges are opposite sides y’ : intersection edges are same side
y
y’1
2
1
1 2
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Scan-Line Polygon Fill (cont.)
Edge Sorted Table
C
C’
B
D
E
A
01
yA
yD
yC
Scan-Line Number
yE xA1/mAE yB xA
1/mAB
yC’ xD1/mDC yE xD
1/mDE
yB xC1/mCB
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Inside-Outside Tests
Self-Intersections Odd-Even rule Nonzero winding
number rule
exterior
interior
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Boundary-Fill Algorithm
Proceed to Neighboring Pixels 4-Connected 8-Connected
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Antialiasing
Aliasing Undersampling: Low-frequency sampling
Nyquist sampling frequency: Nyquist sampling interval:
max2 ff s
2cyclex
xs
original
sample
reconstruct
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Antialiasing (cont.)
Supersampling (Postfiltering) Pixel-weighting masks
Area Sampling (Prefiltering) Pixel Phasing
Shift the display location of pixel areas Micropositioning the electron beam in relation to obje
ct geometry
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Supersampling
Subpixels Increase resolution
10 11 12
20
21
22
(10, 20): Maximum Intensity
(11, 21): Next Highest Intensity
(11, 20): Lowest Intensity
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Supersampling
Subpixels Increase resolution
10 11 12
20
21
22
(10, 20): Maximum Intensity
(11, 21): Next Highest Intensity
(11, 20): Lowest Intensity
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Pixel-Weighting Masks
Give More Weight to Subpixels Near the Center of a Pixel Area
1 2 1
2 4 2
1 2 1
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Area Sampling
Set Each Pixel Intensity Proportional to the Area of Overlap of Pixel 2 adjacent vertical (or horizontal) screen grid lines
trapezoid
10 11 12
20
21
22
(10, 20): 90%
(10, 21): 15%
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Filtering Techniques
Filter Functions (Weighting Surface)
Box Filter Cone Filter Gaussian Filter
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Contents
Display Hardware How are images display?
Raster Graphics Systems How are imaging system organized?
Output Primitives How can we describe shapes with primitives?
Color Models How can we describe and represent colors?
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Electromagnetic Spectrum
Visible Light Frequencies Range between Red: 4.3 x 1014 hertz (700nm) Violet: 7.5 x 1014 hertz (400nm)
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Visible Light
The Color of Light is Characterized by Hue: dominant frequency (highest peak) Saturation: excitation purity (ratio of highest to rest) Brightness: luminance (area under curve)
White Light Orange Light
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Color Perception
Tristimulus Theory of Color Spectral-response fun
ctions of each of the three types of cones on the human retina
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
Color Models
RGB XYZ CMY HSV Others
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
RGB Color Model
Colors are Additive R G B Color
0.0 0.0 0.0 Black
1.0 0.0 0.0 Red
0.0 1.0 0.0 Green
1.0 1.0 0.0 Yellow
1.0 0.0 1.0 Magenta
0.0 1.0 1.0 Cyan1.0 1.0 1.0 WhiteWhite
0.0 0.0 1.0 Blue
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
RGB Color Cube
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
RGB Spectral Colors
Amounts of RGB Primaries Needed to Display Spectral Colors
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
XYZ Color Model (CIE)
Amounts of CIE Primaries Needed to Display Spectral Colors
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
CIE Chromaticity Diagram
Normalized Amounts of X and Y for Colors in Visible Spectrum
(white)
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
CIE Chromaticity Diagram
Define Color Gamuts
Represent Complementary
Color
Determine Dominant Wavelength
and Purity
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
RGB Color Gamut
Color Gamut for a Typical RGB Computer Monitor
(red)
(green)
(blue)
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
CMY Color Model
Colors are Subtractive C M Y Color
0.0 0.0 0.0 WhiteWhite
1.0 0.0 0.0 Cyan
0.0 1.0 0.0 Magenta
1.0 1.0 0.0 Blue
1.0 0.0 1.0 Green
0.0 1.0 1.0 Red1.0 1.0 1.0 Black
0.0 0.0 1.0 Yellow
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
CMY Color Cube
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
HSV Color Model
Select a Spectral Color (Hue) and the Amount of White (Saturation) and Black (Value)
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
HSV Color Model
H S V Color
0 1.0 1.0 Red60 1.0 1.0 Yellow
120 1.0 1.0 Green
240 1.0 1.0 Blue
300 1.0 1.0 Magenta* 0.0 1.0 WhiteWhite* 0.0 0.5 Gray
180 1.0 1.0 Cyan
* * 0.0 Black
cgvr.korea.ac.kr
CGVR
Graphics Lab @ Korea University
HSV Color Model
Cross Section of the HSV Hexcone
Recommended