Image Processing Reference
In-Depth Information
s
=1
2
∂
E
dx s
ds
()
+
dxs
ds
()
+
1
!
"
2
2
!
"
!
"
d
ds
d
ds
edge
-
( )
s
( )
s
2
ˆˆ
() = 0
sds
x
∂
x
2
s
=0
xy
,
(6.27)
Since this equation holds for all
x
(
s
) then,
∂
E
dx s
ds
()
+
!
"
dxs
ds
2
()
+
1
2
!
"
2
2
d
ds
d
ds
edge
(6.28)
-
( )
s
( )
s
= 0
2
∂
x
xy
ˆˆ
,
Similarly, by a similar development of Equation 6.25 we obtain
2
∂
E
dy s
ds
()
+
dys
ds
()
+
1
2
!
"
2
2
!
"
d
ds
d
ds
edge
-
( )
s
( )
s
= 0
(6.29)
∂
y
2
ˆˆ
xy
,
This has reformulated the original energy minimisation framework, Equation 6.7, into a
pair of differential equations. To implement a complete snake, we seek the solution to
Equation 6.28 and Equation 6.29. By the method of finite differences, we substitute for
d
x
(
s
)/
ds
x
s
+1
-
x
s
, the first-order difference, and the second-order difference is
d
2
x
(
s
)/
ds
2
≅
≅
x
s
+1
- 2
x
s
+
x
s
-1
(as in Equation 6.12), which by substitution into Equation 6.28, for a
contour discretised into
S
points equally spaced by an arc length
h
(remembering that the
indices
s
[1,
S
) to snake points are computed modulo
S
), gives
(
x
-
x
)
-
( -
x
x
)
-
1
!
"
s
+1
s
s
s
-1
s
+1
s
h
h
h
x
-2
x
+
x
)
-2
(
x
2+)
+
x
x
(-2 +
x
x
x
)
1
!
"
s
+2
s
+1
s
s
+1
s
s
-1
s
s
-1
s
-2
+
s
+1
s
s
-1
2
2
2
2
h
h
h
h
∂
E
+
1
2
edge
= 0
(6.30)
∂
x
x
ss
,
By collecting the coefficients of different points, Equation 6.30 can be expressed as
f
s
=
a
s
x
s
-2
+
b
s
x
s
-1
+
c
s
x
s
+
d
s
x
s
+1
+
e
s
x
s
+2
(6.31)
where
∂
E
= -
2(
+
)
-
= -
1
2
edge
s
-1
4
s
s
-1
s
f
a
=
b
s
s
s
∂
x
4
2
h
h
h
xy
,
ss
+ 4
+
+
= -
2(
+
)
-
s
+1
s
s
-1
s
+1
s
s
+1
s
s
+1
2
s
+1
4
c
=
+
d
e
=
s
s
s
4
2
4
h
h
h
h
h
This is now in the form of a linear (matrix) equation:
Ax
=
fx
(
x
,
y
)
(6.32)