5.2 Image Warping

How would you make a sharpening filter using gradient domain processing? What are the constraints on the gradients and the intensities?
α(S(x,y)−S(x+1,y))≈t(x,y)−t(x+1,y)
where
- α>1
- We simply use α to increase the gradient to enlarge the difference between neighboring pixels
Image Warping
- Changing the domain or corner of an image

Parametric Warping

- Transformation T is a coordinate-changing machine:
p′=T(p)
What does it me3an that T is global?
- Is the same for any point p
- For lienar transformations, we can represent T as a matrix
p′=Mp[x′y′]=M[x′y′]

Scaling
- A coordinate means multiplying each of its components by a scalar
∙ Uniform scaling
- The scalar applied is the same for all components:

∙ Non-uniform scaling
- different scalars per component:

Formula
x′=axy′=by[x′y′]=[a00b][xy]
Tip
To transform back from (x’, y’), you just change a and b to a1 and b1 (inverse of the matrix)
2-D Rotation

x=rcos(ϕ)y=rsin(ϕ)x′=rcos(ϕ+θ)y′=rsin(ϕ+θ)
x′y′⟹=r(cos(ϕ)cos(θ)−sin(ϕ)sin(θ))=xcos(θ)−y(sinθ)=r(sin(ϕ)cos(θ)+cos(ϕ)sin(θ))=xsin(θ)+ycos(θ)[x′y′]=[cos(θ)sin(θ)−sin(θ)cos(θ)][xy]
Important
Even though cos and sin are non-linear functions, x′ and y′ are linear combinations of x and y.
Tip
Inverse Transformation
- Rotation by −θ
- For rotation matrices R−1=RT
Operations for 2x2 Matrices
Identity
[x′y′]=[1001][xy]
Scale around (0, 0)
[x′y′]=[sx00sy][xy]
2D Rotate around (0, 0)
[x′y′]=[cos(θ)sin(θ)−sin(θ)cos(θ)][xy]
2D Shear
- Transform a rectangular shape to a parallegram
[x′y′]=[1kxky1][xy]
Mirror about Y axis
[x′y′]=[−1001][xy]
Mirror over (0, 0)
[x′y′]=[−100−1][xy]
Caution
2D translation is NOT FEASIBLE
Due to the consant terms for translating x and y
- x′=x+tx
- y′=y+ty
Homogeneous Coordinates
- Represent coordinates in 2 dimensions with a 3-vector
[xy]→homogeneous coordsxy1
- Homogeneous coordinates are scale-invariant
- Any scale version of this vector represents the same point:
(X,Y,Z,1)∼(λX,λY,λZ,λ)

Warning
- (x,y,0) represents a point at infinity
- (0,0,0) is not allowed
2D Image Transformations

∙ Translation
Form
- x′=x+tx,y′=y+ty
Matrix
[I∣t]
DoF
- 2:(tx,ty)
Preserves
- Every relative geometry as it only shifts the pixels
∙ Rigid (Euclidean)
Form
- x′=Rx+tx,y′=Ry+ty
Matrix
[R∣t],R=[cos(θ)sin(θ)−sin(θ)cos(θ)]
DoF
- 3:θ,(tx,ty)
Preserves
- Lengths, angles, parallelism, straight lines, orientation.
∙ Similarity
- uniform scale + rotation + translation
Form
- x′=sRx+tx,y′=sRy+ty(s>0)
Matrix
[sR∣t],R=[cos(θ)sin(θ)−sin(θ)cos(θ)]
DoF
- 4:s,θ,(tx,ty)
Preserves
∙ Affine
Form
- x′=Ax+tx,y′=Ay+ty(A is any 2x2 matrix)
Matrix
[A∣t]
DoF
- 6:A=[abcd],(tx,ty)
Preserves
- Parallelism and ratios of lengths along a line.
∙ Projective (Homography)
Form
- x~′∼Hx~(H∈R3×3,x~=(x,y,1)T)
Matrix
H=abcdefghi
DoF
- 8:A=9 entries minus 1 overall scale constraint
Preserves
- Straight lines. Parallel lines need not remain parallel.