Image Understanding II: Today We Look at Methods That Search For Image Features With Certain Characteristics, E.G
Image Understanding II: Today We Look at Methods That Search For Image Features With Certain Characteristics, E.G
1
E int v s = { s∣v I s∣2 s∣v II s ∣2 }
2
“membrane” term (α and β often
“thin plate” term constant)
Gaussian smoothed input image
{
G⊗ I
2
v s = −∣∇ I ∣
E ext ∇ I =∇ G⊗ I
∂
derivative of gradient direction
∂ n perpendicular to gradient
Snakes
● Minimizing this:
1
1
E = ∫2 { ∣v
I
s∣2
∣v
II
s∣2
}E ext v sds
0
int
F ext
F
● We solve using gradient descent:
∂ v s , t II IIII
= v s , t − v s , t −∇ E ext
v s ,t
∂t
Snakes, Discrete
● Discretizing the gradient gradient descent equation
∂ v s , t II IIII
= v s , t − v s ,t −∇ E ext
v s ,t
∂t
Xt is a vector with x-values
∂ Xt
= A X t f x X t ,Y t of coordinates of points along
∂t the curve; Yt is the y-values
X t −X t −1 ∂
fx = E ext
= A X t f x X t ,Y t ∂x
step size A is a pentadiagonal banded
matrix (cyclic if curve is closed)
−1
X t = I− A { X t −1 f x X t ,Y t } (invert with Cholesky decomposition)
( we assume f x X t ,Y t ≈f x X t −1 ,Y t −1 )
Things to Consider
● Important parameters:
– α, β and γ
– Eext
– initial snake {X0,Y0}
– number of iterations
● The curve needs to be sampled densely to be able to
compute v s accurately
IIII
● When the snake evolves, it is important to resample the
curve regularly
Snakes in Action
● Solution:
don’t use an external energy, but an external force!
When using E ext , the gradient descent equation had
an external force F ext=∇ E ext
Improving the Snake
● Add a dynamic force:
(depends on the curve)
– the balloon force
high gradient
low gradient
high gradient
high intensity
high gradient
(play demo)
Static Forces
E = Canny I D = DT E ext = −∇ D
F
The Distance Force
γ ∈ [1,3] r = x 2 y 2
γ = 2 ⇒ gravitation!
ε is some small
value to avoid
division by 0
Vector Field Convolution
wire curvature
S pk = k pk
eigenvalue
unit-length vector
S is 2Nx2N covariance matrix
The Active Shape Model
● Any allowed shape is given by:
x = x P
b P= p1 , p2 ,... , p K K≤2 N
(matrix formed by first K eigenvectors)
weights to be fitted
−3 i ≤b i ≤3 i
x = Ms , x P
b T x o , y o
● Repeat until convergence:
– look for a better position for each of the points on the shape
– split the movement into rigid and non-rigid components
– transform non-rigid components into a shape change
– constrain shape change to allowed shapes
● “Convergence” can be defined in many ways...
Fitting an ASM to an Image
● Step 1: Look, for each point, along normal of curve, for
a strong edge
– this yields an adjustment for each point d x j = m n
∣∇ I∣
n m
x j
d x composed of all d x j so
that x d x is the new shape
Fitting an ASM to an Image
● Step 2: Find a ds, dθ, dxo and dyo that best aligns
x to x d x
● Step 3: Find residual adjustments d u in local
coordinate frame:
x = Ms , x P
b T x o , y o
du
= Msd s −1 −1
, d {M x P b d x −T d x
s , o }
,d y o − x P
b
Fitting an ASM to an Image
● Step 4a: Map d
u onto subdomain P:
d b = P T d
u (note that P T =P−1 )
(this is a least-squares approximation!)
{
s s s d s
d −3 i ≤b i ≤3 i
xo x o x d x o
o
t=80
t=0 t=200
Active Appearance Models
● Just like ASM, but also includes information on grey
values inside of shape:
– 2N parameters describing boundary of shape
– PCA yields n shape vectors
– M parameters describing grey values
(i.e. the pixels after scaling, rotating and shifting the patch to the
mean shape)
– PCA yields m intensity vectors
– we now have n+m vectors, which we combine but weigh
differently, depending on relative importance
– perform PCA again on matrix of vectors, further simplifying
the model
● Joakim’s lecture on PCA will demonstrate this further
Level Sets
● Developed for physics simulations, to model solid/liquid
interfaces that move at curvature-dependent speeds
Osher & Sethian (1988)
● Applied to images as a substitute for snakes
Caselles, Catté, Coll & Dibos (1993)
Malladi, Sethian & Vemuri (1995)
● Addresses problems with snakes:
– sampling of snake is problematic
– snake cannot split or merge
(if there’s two objects in the image, start with two snakes)
– snakes in higher dimensions are complex
● Simple to understand, a little harder to implement
Level Sets
● Instead of defining a curve through a set of sample
points, we embed the curve in a higher-dimensional
space
– for example: instead of a 1D curve in 2D, we have a 2D
surface in 3D
● The curve is the set of points for which the surface
crosses the 0 level
z ψ
x
v s
= { =0 } y
y γ
x
x
Level Sets
Note:
● nothing special is required for the curve to split into two
● the shape of the function away from the zero level set is not important
F = k F A F G ∇
F G = ∇⋅
∣∇ ∣
geometry term,
curvature dependent
(= internal forces) 1
advection term, k =
1∣∇ G ⊗ I∣
constant speed
(= balloon force) (small at edges)
Improving Level Sets
● If the image gradient is weak, the curve can pass it
● Once passed this point, it cannot go back
● Solution: add a term that pulls curve towards edges
– seems logical, considering what we learned with snakes!
∂t
A
∣∇ ∣
∂ k F ∇⋅ ∇ ∣∇ ∣ ∇ k ∇ = 0
6 px
Example