Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105206065
2_affine.tex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 15, 10:48
Size
7 KB
Mime Type
text/x-tex
Expires
Mon, Mar 17, 10:48 (2 d)
Engine
blob
Format
Raw Data
Handle
24940595
Attached To
R2653 epfl
2_affine.tex
View Options
\documentclass
[aspectratio=169]
{
beamer
}
\def\stylepath
{
../../styles
}
\usepackage
{
\stylepath
/com303
}
\begin
{
document
}
\begin
{
frame
}
\frametitle
{
Affine transforms
}
\centering
mapping
$
\mathbb
{R}^
2
\rightarrow
\mathbb
{R}^
2
$
that reshapes the coordinate system:
\[
\begin
{bmatrix} t'_
1
\\
t'_
2
\end
{bmatrix}
=
\begin
{bmatrix} a_{
11
} & a_{
12
}
\\
a_{
21
} & a_{
22
}
\end
{bmatrix}
\begin
{bmatrix} t_
1
\\
t_
2
\end
{bmatrix}
-
\begin
{bmatrix} d_
1
\\
d_
2
\end
{bmatrix}
\]
\pause
\vspace
{
2em
}
\[
\begin
{bmatrix} t'_
1
\\
t'_
2
\end
{bmatrix}
=
\mathbf
{A}
\begin
{bmatrix} t_
1
\\
t_
2
\end
{bmatrix}
-
\mathbf
{d}
\]
\end
{
frame
}
\def\flag
{
\psline
(-.5,-1)(-.5,1.2)(1,1.2)(0.5,0.7)(1,0.2)(-.5,0.2)
}
\def\grayFlag
{
\psline
[linecolor=lightgray]
(-.5,-1)(-.5,1.2)(1,1.2)(0.5,0.7)(1,0.2)(-.5,0.2)
}
\begin
{
frame
}
\frametitle
{
Translation
}
\begin
{
columns
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
1
&
0
\\
0
&
1
\end
{
bmatrix
}
=
\mathbf
{
I
}
\\
\mathbf
{
d
}
&
=
\begin
{
bmatrix
}
d
_
1
\\
d
_
2
\end
{
bmatrix
}
\end
{
align*
}
\end
{
column
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
center
}
\begin
{
dspCP
}
[width=5cm,xticks=5,yticks=5,xout=true]
{
-3,3
}{
-3,3
}
\moocStyle
\only
<1>
{
\flag
}
\only
<2>
{
%
\grayFlag
\rput
(0.7,0.3)
{
\flag
}}
\end
{
dspCP
}
\end
{
center
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Scaling
}
\begin
{
columns
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
a
_
1
&
0
\\
0
&
a
_
2
\end
{
bmatrix
}
\\
\mathbf
{
d
}
&
= 0
\end
{
align*
}
\vspace
{
1em
}
if
$
a_
1
=
a_
2
$
the
{
\em
aspect ratio
}
is preserved
\end
{
column
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
center
}
\begin
{
dspCP
}
[width=5cm,xticks=5,yticks=5,xout=true]
{
-3,3
}{
-3,3
}
\moocStyle
\only
<1>
{
\flag
}
\only
<2>
{
%
\grayFlag
\psscalebox
{
1.5
}{
\flag
}}
\end
{
dspCP
}
\end
{
center
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Rotation
}
\begin
{
columns
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
\cos\theta
&
-
\sin\theta
\\
\sin\theta
&
\cos\theta
\end
{
bmatrix
}
\\
\mathbf
{
d
}
&
= 0
\end
{
align*
}
\end
{
column
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
center
}
\begin
{
dspCP
}
[width=5cm,xticks=5,yticks=5,xout=true]
{
-3,3
}{
-3,3
}
\moocStyle
\only
<1>
{
\flag
}
\only
<2>
{
%
\grayFlag
\rput
{
110
}{
\flag
}}
\only
<3>
{
%
\grayFlag
\rput
{
180
}{
\flag
}}
\end
{
dspCP
}
\end
{
center
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Flips
}
\begin
{
columns
}
\begin
{
column
}{
0.45
\paperwidth
}
Horizontal:
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
-1
&
0
\\
0
&
1
\end
{
bmatrix
}
\\
\mathbf
{
d
}
&
= 0
\end
{
align*
}
Vertical:
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
1
&
0
\\
0
&
-1
\end
{
bmatrix
}
\\
\mathbf
{
d
}
&
= 0
\end
{
align*
}
\end
{
column
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
center
}
\begin
{
dspCP
}
[width=5cm,xticks=5,yticks=5,xout=true]
{
-3,3
}{
-3,3
}
\moocStyle
\only
<1>
{
\flag
}
\only
<2>
{
\grayFlag
\psscalebox
{
-1 1
}{
\flag
}}
\end
{
dspCP
}
\end
{
center
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Shear
}
\begin
{
columns
}
\begin
{
column
}{
0.45
\paperwidth
}
Horizontal:
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
1
&
s
\\
0
&
1
\end
{
bmatrix
}
\\
\mathbf
{
d
}
&
= 0
\end
{
align*
}
Vertical:
\begin
{
align*
}
\mathbf
{
A
}
&
=
\begin
{
bmatrix
}
1
&
0
\\
s
&
1
\end
{
bmatrix
}
\\
\mathbf
{
d
}
&
= 0
\end
{
align*
}
\end
{
column
}
\begin
{
column
}{
0.45
\paperwidth
}
\begin
{
figure
}
\begin
{
center
}
\begin
{
dspCP
}
[width=5cm,xticks=5,yticks=5,xout=true]
{
-3,3
}{
-3,3
}
\moocStyle
\only
<1>
{
\flag
}
\only
<2>
{
\grayFlag
\def\s
{
0.5
}
\psline
(! -.5 -1 dup
\s
mul 3 -1 roll add exch)(! -.5 1.2 dup
\s
mul 3 -1 roll add exch)(! 1 1.2 dup
\s
mul 3 -1 roll add exch)(! 0.5 0.7 dup
\s
mul 3 -1 roll add exch)(! 1 0.2 dup
\s
mul 3 -1 roll add exch)(! -.5 0.2 dup
\s
mul 3 -1 roll add exch)
}
\end
{
dspCP
}
\end
{
center
}
\end
{
figure
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Affine transforms in discrete-space
}
\[
\begin
{bmatrix} t'_
1
\\
t'_
2
\end
{bmatrix}
=
\mathbf
{A}
\begin
{bmatrix} n_
1
\\
n_
2
\end
{bmatrix}
-
\mathbf
{d}
\quad
{
\color
{red}
\in
\mathbb
{R}^
2
\neq
\mathbb
{Z}^
2
}
\]
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Solution for images
}
\begin
{
itemize
}
[<+->]
\item
take each
{
\em
output point
}
$
y
[
m_
1
, m_
2
]
$
\item
apply the
{
\em
inverse
}
transform to
$
[
m_
1
, m_
2
]
$
and find the
{
\em
source
}
point's coordinates:
\[
\begin
{bmatrix} t_
1
\\
t_
2
\end
{bmatrix}
=
\mathbf
{A}^{
-
1
}
\begin
{bmatrix} m_
1
+
d_
1
\\
m_
2
+
d_
2
\end
{bmatrix};
\]
\item
if source point not on source grid, write
\[
(
t_
1
, t_
2
)
=
(
\eta
_
1
+
\tau
_
1
,
\eta
_
2
+
\tau
_
2
)
,
\qquad
\eta
_{
1
,
2
}
\in
\mathbb
{Z},
\quad
0
\le
\tau
_{
1
,
2
} <
1
\]
and interpolate from the surrounding original grid points
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Bilinear Interpolation
}
\begin
{
figure
}
\label
{
bilinearInt
}
\begin
{
center
}
\begin
{
dspCP
}
[width=6cm,xticks=custom,yticks=custom,xout=true]
{
0.5,2.5
}{
0.5,2.5
}
\only
<1-2>
{
\dspPointValue
[linecolor=blue]
{
2,2
}{
$
x
[
\eta
_
1
+
1
,
\eta
_
2
+
1
]
$
}
\dspPointValue
[linecolor=blue]
{
1,1
}{
$
x
[
\eta
_
1
,
\eta
_
2
]
$
}}
\only
<3->
{
\dspPointValue
[linecolor=blue]
{
2,2
}{}
\dspPointValue
[linecolor=blue]
{
1,1
}{}}
\dspPointValue
[linecolor=blue]
{
2,1
}{}
\dspPointValue
[linecolor=blue]
{
1,2
}{}
%
\only
<2>
{
\dspPointValue
[linecolor=red]
{
1.3,1.7
}{
$
(
t_
1
,t_
2
)
$
}}
\only
<3->
{
\dspPointValue
[linecolor=red]
{
1.3,1.7
}{}}
%
\only
<3->
{
\psline
[linewidth=0.5pt]
{
<->
}
(1,1)(1.3,1)
\dspText
(1.14,0.9)
{
$
\tau
_
1
$
}}
\only
<3,5->
{
\psline
[linewidth=0.5pt]
{
<->
}
(1.3,1)(1.3,1.7)
\dspText
(1.4,1.3)
{
$
\tau
_
2
$
}}
%
\only
<4->
{
\psline
[linewidth=0.5pt,linestyle=dotted]
(1,1)(2,1)
\psline
[linewidth=0.5pt,linestyle=dotted]
(1,2)(2,2)
\dspPointValue
[dotstyle=triangle*,linecolor=green]
{
1.3,1
}{}
\dspPointValue
[dotstyle=triangle*,linecolor=green]
{
1.3,2
}{}}
%
\only
<5->
{
\psline
[linewidth=0.5pt,linestyle=dotted]
(1.3,1)(1.3,2)
}
%
\dspCustomTicks
[axis=x]
{
1
$
\eta
_
1
$
2
$
\eta
_
1
+
1
$
}
\dspCustomTicks
[axis=y]
{
1
$
\eta
_
2
$
2
$
\eta
_
2
+
1
$
}
\end
{
dspCP
}
\end
{
center
}
\end
{
figure
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Bilinear Interpolation
}
If we use a first-order interpolator:
\begin
{
align*
}
y[m
_
1,m
_
2]
&
= (1-
\tau
_
1)(1-
\tau
_
2)x[
\eta
_
1,
\eta
_
2] +
\tau
_
1(1-
\tau
_
2)x[
\eta
_
1+1,
\eta
_
2]
\\
&
+ (1-
\tau
_
1)
\tau
_
2x[
\eta
_
1,
\eta
_
2+1] +
\tau
_
1
\tau
_
2x[
\eta
_
1+1,
\eta
_
2+1]
\end
{
align*
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Shearing
}
\begin
{
figure
}
\includegraphics
[height=6cm]
{
\imagePath
/shear.eps
}
%
\end
{
figure
}
\end
{
frame
}
\end
{
document
}
Event Timeline
Log In to Comment