Title: Recap from Monday
1Recap from Monday
DCT and JPEG Point Processing Histogram
Normalization Questions JPEG compression
levels Gamma correction
2JPEG Clarifications
- Compression level is indeed adjusted by changing
the magnitude of the quantization table. - JPEG often preferentially compresses color
information.
3Gamma Correction
- Is an instance of these power law intensity
transformations. - Typically, gamma 2.2 for a display device, and
1/2.2 for encoding. - The result is a more perceptually uniform
encoding.
4Gamma Correction
- Image encoded for various display gammas.
Source Wikipedia
5Image Warping
http//www.jeffrey-martin.com
cs195g Computational Photography James Hays,
Brown, Spring 2010
Slides from Alexei Efros and Steve Seitz
6Image Transformations
- image filtering change range of image
- g(x) T(f(x))
image warping change domain of image g(x)
f(T(x))
7Image Transformations
- image filtering change range of image
- g(x) T(f(x))
f
g
image warping change domain of image g(x)
f(T(x))
f
g
8Parametric (global) warping
- Examples of parametric warps
aspect
rotation
translation
perspective
cylindrical
affine
9Parametric (global) warping
p (x,y)
p (x,y)
- Transformation T is a coordinate-changing
machine - p T(p)
- What does it mean that T is global?
- Is the same for any point p
- can be described by just a few numbers
(parameters) - Lets represent T as a matrix
- p Mp
10Scaling
- Scaling a coordinate means multiplying each of
its components by a scalar - Uniform scaling means this scalar is the same for
all components
? 2
11Scaling
- Non-uniform scaling different scalars per
component
12Scaling
- Scaling operation
- Or, in matrix form
scaling matrix S
Whats inverse of S?
132-D Rotation
x x cos(?) - y sin(?) y x sin(?) y cos(?)
142-D Rotation
x r cos (f) y r sin (f) x r cos (f ?) y
r sin (f ?) Trig Identity x r cos(f)
cos(?) r sin(f) sin(?) y r sin(f) cos(?) r
cos(f) sin(?) Substitute x x cos(?) - y
sin(?) y x sin(?) y cos(?)
f
152-D Rotation
- This is easy to capture in matrix form
- Even though sin(q) and cos(q) are nonlinear
functions of q, - x is a linear combination of x and y
- y is a linear combination of x and y
- What is the inverse transformation?
- Rotation by q
- For rotation matrices
R
162x2 Matrices
- What types of transformations can be represented
with a 2x2 matrix?
2D Identity?
2D Scale around (0,0)?
172x2 Matrices
- What types of transformations can be represented
with a 2x2 matrix?
2D Rotate around (0,0)?
2D Shear?
182x2 Matrices
- What types of transformations can be represented
with a 2x2 matrix?
2D Mirror about Y axis?
2D Mirror over (0,0)?
192x2 Matrices
- What types of transformations can be represented
with a 2x2 matrix?
2D Translation?
NO!
Only linear 2D transformations can be
represented with a 2x2 matrix
20All 2D Linear Transformations
- Linear transformations are combinations of
- Scale,
- Rotation,
- Shear, and
- Mirror
- Properties of linear transformations
- Origin maps to origin
- Lines map to lines
- Parallel lines remain parallel
- Ratios are preserved
- Closed under composition
21Consider a different Basis
j (0,1)
q
i (1,0)
q4i3j (4,3)
p4u3v
22Linear Transformations as Change of Basis
j (0,1)
v (vx,vy)
puv
pij
u(ux,uy)
i (1,0)
pij 4u3v
puv (4,3)
px4ux3vx py4uy3vy
- Any linear transformation is a basis!!!
23Whats the inverse transform?
v (vx,vy)
j (0,1)
puv
pij
u(ux,uy)
i (1,0)
pij (5,4)
puv (px,py) ?
pxu pyv
- How can we change from any basis to any basis?
- What if the basis are orthogonal?
24Projection onto orthogonal basis
v (vx,vy)
j (0,1)
puv
pij
u(ux,uy)
i (1,0)
pij (5,4)
puv (upij, vpij)
ù
é
ù
é
u
u
u
u
ù
é
5
y
x
x
x
puv
pij
ú
ê
ú
ê
ú
ê
v
v
v
v
4
û
ë
û
ë
û
ë
y
x
y
y
25Homogeneous Coordinates
- Q How can we represent translation as a 3x3
matrix?
26Homogeneous Coordinates
- Homogeneous coordinates
- represent coordinates in 2 dimensions with a
3-vector
homogenouscoords
27Homogeneous Coordinates
- Add a 3rd coordinate to every 2D point
- (x, y, w) represents a point at location (x/w,
y/w) - (x, y, 0) represents a point at infinity
- (0, 0, 0) is not allowed
Convenient coordinate system to represent many
useful transformations
28Homogeneous Coordinates
- Q How can we represent translation as a 3x3
matrix? - A Using the rightmost column
29Translation
Homogeneous Coordinates
tx 2ty 1
30Basic 2D Transformations
- Basic 2D transformations as 3x3 matrices
Translate
Scale
Rotate
Shear
31Matrix Composition
- Transformations can be combined by matrix
multiplication
p T(tx,ty) R(Q)
S(sx,sy) p
32Affine Transformations
- Affine transformations are combinations of
- Linear transformations, and
- Translations
- Properties of affine transformations
- Origin does not necessarily map to origin
- Lines map to lines
- Parallel lines remain parallel
- Ratios are preserved
- Closed under composition
- Models change of basis
- Will the last coordinate w always be 1?
33Projective Transformations
- Projective transformations
- Affine transformations, and
- Projective warps
- Properties of projective transformations
- Origin does not necessarily map to origin
- Lines map to lines
- Parallel lines do not necessarily remain parallel
- Ratios are not preserved
- Closed under composition
- Models change of basis
342D image transformations
- These transformations are a nested set of groups
- Closed under composition and inverse is a member
35Matlab Demo
help imtransform