Professional Documents
Culture Documents
Recap
Artistic Warps
Superpositions
Tiling Effects
Pixelize
Slices
Radial Tiles
Mesh Warping
Mappings between Quadrilaterals
Summary
Recap
example
Recap
approach (1D)
I we consider a warp functionT to the effect
g̃(x̃) = g(T(x))
and
approach (1D)
I that is
T(x) = δ+ (x) + x
T(x) = δ· (x) · x
Recap
r r2
original δ+ = −r · 1 − rmax δ+ = −r · 1 − 2
rmax
Recap
√2 −r2
rmax r2
δ+ = −r · rmax δ+ = −r · tanh r
rmax δ+ = −r · exp − 21 2
rmax
Recap
T = T(µ, x) = T(r, x)
where
r=µ−x
Recap
T = T(µ, x) = T(r, x)
where
r=µ−x
T(µ, x) = x + ∆(µ − x)
Recap
example
I here, we applied
(µ−x)2
g̃(x) = g x + e−
2σ2 · (µ − x)
waves effect
I transform the image such that it appears as if on the
bottom of a swimming pool whose water is in motion
example
Recap
approach (1D)
I as usual, we are interested in g̃(x̃) = g T(x)
I we choose
T(x) = x + α sin(νx − φ)
swirl effect
I twist an image about a point µ just as if you would put an
immersion blender into it
example
Recap
principle
I each pixel x of the images is being displaced by a vector ∆
∆
r
x x
r ϕ′ r
ϕ
µ µ
Recap
T(r, x) = x + ∆(r)
where we choose
cos ϕ(r) + δ+ krk − cos ϕ(r)
∆(r) = krk ·
+
sin ϕ(r) + δ krk − sin ϕ(r)
Artistic Warps
observation
I the idea of understanding effects to be caused by a central
force allows for an easy extension towards multiple centers
Artistic Warps
observation
I the idea of understanding effects to be caused by a central
force allows for an easy extension towards multiple centers
I to this end, we make use of the principle of superposition
Artistic Warps
observation
I the idea of understanding effects to be caused by a central
force allows for an easy extension towards multiple centers
I to this end, we make use of the principle of superposition
I for instance, if we are given n centers µ1 , µ2 , . . . , µn of
forces, we can define more general transformation
functions
X
n
T(r1 , r2 , . . . , rn , x) = x + ∆(ri , π1 , π2 , . . . , πm )
i=1
example (I)
Artistic Warps
example (II)
Artistic Warps
example (III)
Artistic Warps
explanation
I the examples show superimposed fisheye, waves,
and swirl effects
pixelize
I artificially reduce the resolution of an image
example
Original 10 × 10
Tiling Effects
example
20 × 20 40 × 40
Tiling Effects
approach
I combine several pixels into superpixels
Tiling Effects
approach
I combine several pixels into superpixels
approach
I combine several pixels into superpixels
y = 0
while y < rmax:
x = 0
while x < cmax:
meancolor = 0.0
for y2 in range(tileziseY):
for x2 in range(tilesizeX):
meancolor += gOrig[y+y2,x+x2]
for y2 in range(tileziseY):
for x2 in range(tilesizeX):
gWarp[y+y2,x+x2] = int(meancolor)
x += tilesizeX
y += tilesizeY
Tiling Effects
slices
I divide an image into many tiny mosaic pieces and slightly
shift their positions
example
example
approach
I implement loops similar to the pixelize effect
import numpy as np
y = 0
while y < rmax:
x = 0
while x < cmax:
dx = np.random.randint(-dXmax, dXmax)
dy = np.random.randint(-dYmax, dYmax)
for y2 in range(tileziseY):
for x2 in range(tilesizeX):
if y+y2+dy >= 0 and y+y2+dy < rmax and \\
x+x2+dx >= 0 and x+x2+xy < cmax:
g_warp[y+y2+dy,x+x2+dx] = g_orig[y+y2,x+x2]
x += tilesizeX
y += tilesizeY
Tiling Effects
variation
I punch out confetti and slightly shift them
example
example
radial tiles
I transit to polar coordinates and compute tiles along the
radial axis
example
original δ = 10
Tiling Effects
example
δ = 20 δ = 40
Tiling Effects
import numpy as np
for y in range(rmax):
for x in range(cmax):
r = np.sqrt((x-px)**2 + (y-py)**2)
phi = np.atan2(y-py, x-px)
r = r - ((int)r % (int)delta)
u = r * np.cos(phi) + px
v = r * np.sin(phi) + py
gWarp[y,x] = resample(gOrig[u,v])
Mesh Warping
motivation (I)
Mesh Warping
motivation (II)
Mesh Warping
I we have
x−a
x0 = (d − c) + c
b−a
Mesh Warping
x11
xb xd
1 x
x10
x01
v xa
u
xc
x00
u 1
Mesh Warping
bilinear mappings
I we have
u−0
xa = (x10 − x00 ) + x00
1−0
1
= u(x10 − x00 ) + x00 (1)
v u
u−0
xb = (x11 − x01 ) + x01
1−0 u 1
xb xd
and
x
x10
v−0 x01
xa
x= (xb − xa ) + xa xc
1−0 x00
= v(xb − xa ) + xa (3)
Mesh Warping
bilinear mappings
I plugging (1) and (2) into (3) yields
v u
u 1
x11
xb xd
x
x10
x01
xa
xc
x00
Mesh Warping
bilinear mappings
I plugging (1) and (2) into (3) yields
v u
I in matrix form
uv
u 1
x a b c d
u
= x11
y e f g h v
xb xd
1 x
x10
x01
xa
xc
x00
Mesh Warping
bilinear mappings
I for the coefficients a, b, . . . , h we have
note:
x = auv + bu + cv + d
= v(au + c) + bu + d
x − bu − d
⇒v=
au + c
Mesh Warping
y = euv + fu + gv + h
yields
x − bu − d x − bu − d
y =eu + fu + g +h
au + c au + c
⇒ 0 =eu(x − bu − d) + fu(au + c)+
g(x − bu − d) + (h − y)(au + c)
⇔ 0 =eux − ebu2 − eud + fau2 + fcu + gx − gbu − gd+
hau + hc − yau − yc
⇔ 0 =(fa − eb)u2 + (ex − ed + fc − gb + ha − ya)u+
gx − gd + hc − yc
Mesh Warping