Professional Documents
Culture Documents
T G Dissolve Plus T F Dissolve T G F Cross: BB GG RR E
T G Dissolve Plus T F Dissolve T G F Cross: BB GG RR E
T G Dissolve Plus T F Dissolve T G F Cross: BB GG RR E
Perceptual Issues
Humans can discriminate about 0.5 minute of arc
- At fovea, so only in center of view, 20/20 vision
- At 1m, about 0.2mm (Dot Pitch of monitors)
- Limits the required number of pixels
Dynamic Range
Humans can see:
High range, low res
contrast at very low and very high light levels,
but cannot see all levels all the time
- use adaptation to adjust
- high range even at one adaptation level
Film has low dynamic range ~ 100:1
Monitors are even worse ~ 70:1
Display on a Monitor
Voltage to display intensity is not linear (Digital, Analog).
Gamma Control: (Gamma correction)
Idisplay Ito-moniter, so Ito-moniter Idisplay1/
, is controlled by the user,
- Should be matched to a particular monitor
- Typical values are between 2.2 and 2.5
Color
Light and Color
The frequency of light determines its color
- Frequency, wavelength, energy all related
Color Spaces
The principle of trichromacy means: the displayable colors are
all the linear combination of primaries
Taking linear combinations of R, G and B defines the RGB
color space
- The range of perceptible colors generated by adding some part each
of R, G and B.
- If R, G and B are correspond to a monitors phosphors (monitor
RGB), the space is the range of colors displayable on the monitor.
RGB
- Only a small range of all the colors humans are perceivable
(i.e. no magenta on a monitor)
- It is not easy for humans to say how much of RGB to use to
make a given color
- Perceptually non-linear:
- two points a certain distance apart in one part of the space may be
perceptually different
- Two other points, the same distance apart in another part of the
space, may be perceptually the same
# Photons
Seeing in Color
Rods work at low light levels and do not see color
Cones come in three types (experimentally and
genetically proven),
each responds in a
different way to
frequency distributions
HSV
- Hue: the color family: red, yellow, blue
- Saturation: The purity of a color: white is totally unsaturated
- Value: The intensity of a color: white is intense, black isnt
- Space looks like a cone: parts of the cone can be mapped to RGB
-Not a linear space: no linear transform to take RGB to HSV.
Populosity:
Color histogram: count the number of times each color appears
Choose the n most commonly occurring colors
- L-con: red
- M-con: green
- S-con: blue
Color Perception
Colors may be perceived differently:
Median Cut:
Recursively:
Color Deficiency
Red-green color blindness in men
- Red and green receptor genes are carried on X chromosome
- Most of them have two red genes or two green genes
Trichromacy
Experiment:
- Show a target color beside a user controlled color
- User has knobs that add primary sources to their color
- Ask the user to match the colors
- It is possible to match almost all colors using only three primary
sources - the principle of trichromacy
- Sometimes, have to add light to the target
- This was how experimentalists knew there were 3 types of cones
Math:
primaries: A, B and C (can be R, G, B, r, g, b)
Colors: M=aA+bB+cC (Additive matching)
Gives a color description system - two people who agree on A, B,
C need only supply (a, b, c) to describe a color
E rR gG bB
r
r ( ) E ( )d
g ( ) E ( )d
b b( ) E ( ) d
g
Dithering
Why? 1.Adding noise along the boundaries can remove Mach
bands. 2.General perceptive principle: replaced structured
errors with noisy ones and people complain less
Black-and-white to grayscale: I=0.299R+0.587G+0.114B
Threshold Dithering: (Nave) If the intensity < 0.5, replace
with black, else replace with white
- Not good for non-balanced brightness
2223102014
25 3 8 5 17
15 6 1 2 11
12 9 4 7 21
1819132416
random
which
looks
better
Filitering
H ( ) F ( ) G( ) h( x ) f g f (u ) g ( x u )du
Convolution Theorem
Convolution in spatial domainMultiplication in freq. domain
Multiplication in spatial domainConvolution in freq. domain
Aliasing
If the sampling rate is too low, high frequencies get
reconstructed as lower frequencies
boxes
k 1
k 1
- High freq.s from one copy get added to low freq.s from another
I output [ x][ y ]
k /2
k /2
i k / 2 j k / 2
input
[ x i ][ y j ]M [i k / 2][ j k / 2]
1
2
2
1
1
4
4
1
0 0
1 2 1
1 2 1
1
1
1 0 2 4 2 2 12 2
16
16
0 0
1 2 1
1 2 1
Image Warping
Mapping from the points in one image to points in another
f tells where in the new image to put
I out [x] I in [ f (x)]
the data from x in the old image
Reducing Image Size
Warp function: f(x)=kx, k > 1
Problem: More than one input pixel maps to each output pixel
Solution: Apply the filter, only at desired output locations
Enlarging Image
Warp function: f(x)=kx, k < 1
Problem: Have to create pixel data
Solution: Apply the filter at intermediate pixel locations
New pixels are interpolated from old ones
May want to edge-enhance images after enlarging
Image Morphing Process to turn one image into another
7/16
Transformations
Coordinate Systems
are used to describe the locations of points in space.
Multiple coordinate systems make graphics algorithms easier
to understand and implement
- Some operations are easier in one coordinate system than in another
(Box example)
2D Translation
2D Scaling
2D Rotation
x 1 0 x bx
y 0 1 y b
y
x cos
y sin
X-Axis Shear
x s x
y 0
sin x 0
x
cos y 0
3D Rotation
Rotation is about an axis in 3D passing through the origin.
Any matrix with an orthonormal top-left 3x3 sub-matrix is a
rotation
- Rows are mutually orthogonal (0 dot product)
- Determinant is 1
- columns are also orthogonal, and the transpose is equal to the inverse
Problems
Specifying a rotation really only requires 3 numbers
- Axis (a unit vector, requires 2) and Angle to rotate
Alternative Representations
1.Specify the axis and the angle
- Hard to compose multiple rotations
Filtering in Color
Simply filter each of R,G and B separately
Re-scaling and truncating are more difficult to implement:
4.Quaternions
Compositing
Combines components from two or more images to make a new image
Alpha
Basic idea: Encode opacity information in the image
Add an extra alpha channel to each image, RGBA
- =0 is always black
- Some loss of precision as gets small, but generally not a problem
shx x 0
1 y 0
0
1 0 0 1
0 0 1 0
Advantages
1.Unified view of transformation as matrix multiplication
0 x 0
s y y 0
y
0
0 x 0
1 y 0
- Define path from each point in the original image to its destination in
the output image
- Animate points along paths
looks like 2 16 3 13
newsprint 10 6 11 7
4 14 1 15
12 8 9 5
Unary Operators
Darken: Makes an image darker (or lighter) without affecting
its opacity.
darken ( f , ) (rf , g f , b f , f )
Dissolve: Makes an image transparent without affecting its
dissolve ( f , ) (rf , g f , b f , f )
color.
PLUS: Co=Cf+Cg
Example: cross( f , g, t ) dissolve( f , t ) plus dissolve( g,1 t )
Obtaining Values
1.Hand generate (paint a grayscale image)
2.Automatically create by segmenting an image into
foreground background:
Clustered Dithering
Signal Processing
Spatial domain: signal is given as values at points in space
Freq. dom.: signal is given as values of frequency components
Periodic signal: can be represented as a sum of sine and cosine
waves with harmonic frequencies. S ( x) 12 2 (1) cos(22kk 11)x
Non-periodic function: can be
1 2
1
1
F
(
)
e
d
Viewing Transformation
Graphics Pipeline
Local
Coordina
te Space
World
Coordinat
e Space
View
Space
3D
Screen
Space
Displ
ay
Spac
e
View Space
Associate a set of axes with the image plane
- The image plane is the plane in space on which the image should
appear, like the film plane of a camera
- One normal to, one up in, and one right in the image plane
- Some camera parameters are easy to define(focal length, image size)
- Depth is represented by a single number in this space
3D Screen Space
A cube: [-1,1][-1,1][-1,1] ; canonical view volume
- Parallel sides make many operations easier
Clipping
Parts of the geometry may lie outside the view volume
(1,1)
(xmax,ymax)
0
1
0
0
ymax ymin 2 0
0
1
0
0
z screen
0
1
t b t b yview
2
t
b
0
screen
- left, x=l
z screen 0
0
2 n f n f n f zview
- right, x=r(r>l)
0
0
1
1 0
1
- top, y=t
- bottom, y=b(b<t) x screen M view screen x view
1 c z nx
0 1 0
uy
vy
ny
0
uz
vz
nz
0
0
0
0
uz
vz
nz
0
u c
v c
n c
Perspective Projection
- Works like a pinhole camera
- Distant Objects Are Smaller
- Parallel lines meet
Vanishing points
Each set of parallel lines (=direction) meets at a different point:
The vanishing point for this direction
- Classic artistic perspective is 3-point persepctive
- Sets of parallel lines on the same plane lead to collinear vanishing
points: the horizon for that plane
- Good way to spot faked images
d zv
y s yv
d
zv
xv
xs y
y v
s zv
d z
v d
1
0
Ps
0
xv
0
1
0
0
0
0
1
1
d
-zv
d
0
0
P
0 v
Right Clip
Plane
1
0
MP
0
0
1
0
0
0
0 n
0
0 0
n f n f 0
1n
0 0
0
0
n
0
0 n f
0
1
M view screen
2
t b
0
0
2
n f
0
r l
r l n
t b
0
t b 0
n f
n f 0
1
Outside
f
i
Inside
0
nf
0
0
0
0
n f nf
1
0
Always place the near plane as far from the viewer as possible,
and the far plane as close as possible
Decomposition of a Transformation
A = RSRT
Rotate v1 and v2 to the x-and y-axes (the transform by RT.
Scale in x and y by (1 and 2)
Rotate the x- and y-axes back to v1 and v2 (the transformation R).
Box Function
P() = det(A- I)
Para cada , substituir em A- I, achar auto-vetores relacionados a cada autovalor(resolver o Sistema). Lembrar = autovetores em COLUNA.
More about clipping
Cossine
Sutherland-Hogman Clip (polygons)
n (s x) 0
n (i x) 0
n (f x) 0
Sine
Constant Function
Finding Intesection points = find the interseption between plane and line
(remember).
We want parameter values that are inside all the clip planes. Any clip plane that
we started inside we must not have left yet (first parameter value to leave is the
end of the visible segment). Any clip plane that we started outside we must have
already entered (last parameter value to enter is the start of the visible segment).
If we leave some clip plane before we enter another, we cannot see any part of
the line. All this leads to an algorithm Liang Barsky.
Liang-Barsky Sub-Tasks
Delta Function
Gaussian Function
2.
3.
Find last parameter to enter, and first one to leave (check that enter before
leave).
4.
5
6
go up
About color:
go up
1
Otherwise, find parametric intersection: left clip edges: x = e + (xleft e)t, line x
= x1 + (x2 x1)s. Solve simultaneous equations in t and s.
Bartlett filter
Compute inside/outside for endpoints of the line segment. Determine which side
of each clip plane the segment endpoints lie. Use the cross product. If both
segment endpoints are outside one cli plane, stop here if we can.
Liang-Barsky Clipping
0101
Parametric clipping - view line in parametric form and reason
about the parameter values
p1 x
p 2 x
p 3 y
p 4 y
1.
So fazer diagonalizacao:
0
MOM P
Inside-Outside Testing
uy
vy
ny
0
- edge crosses the clip line/plane from out to in: emit crossing point,
next vertex
- edge crosses clip line/plane from in to out: emit crossing
- edge goes from out to out: emit nothing
- edge goes from in to in: emit next vertex
0 1
0 0
0 0
1 0
Sutherland-Hodgman Clip
Clip the polygon against each edge of the clip region in turn
Look at the next vertex in the list, and the edge from the last
vertex to the next. If the
uz
vz
nz
0
uy
vy
ny
0
- The normals to the clip planes point inward, toward the visible stuff
Orthographic Projection
Orthographic projection projects all the points in the world
along parallel lines onto the image plane
u x
v
M world view x
nx
(xmin,ymin)
(-1,-1)