Some Thoughts in Preparation for Coding
Image Processing Problems on a GPU
As a ﬁrst step we want to consider numerical methods for solving the toy problem,
(
−Δu = f,Ω
u = 0,∂Ω
(1)
where Ω = (0,1)
d
,and we’re particularly interested in the twodimensional case with d = 2.
With x
i
= (i −1/2)h,y
j
= (j − 1/2)h,1 ≤ i,j ≤ N,h = 1/N,N = 2
p
,the following ﬁnite
diﬀerence discretization is natural:
1
h
2
[−u(x
i+1
,y
j
) +2u(x
i
,y
j
) −u(x
i−1
,y
j
)] +
1
h
2
[−u(x
i
,y
j+1
) +2u(x
i
,y
j
) −u(x
i
,y
j−1
)] = f(x
i
,y
j
)
(2)
where terms with i ±1,j ±1 outside the range 1 to N are understood to be zero because of the
boundary condition u = 0,∂Ω.With the socalled lexicographic ordering,
x
k
= (x
i
,y
j
)
k = (j −1)N +i
i = mod(k −1,N) +1
j = [(k −1)/N] +1
e.g.,
13
14
15
16
9
10
11
12
5
6
7
8
1
2
3
4
(3)
the discretization in (2) can be written in terms of u
lex
= {u
k
}
N
2
k=1
,u
k
= u(x
k
) and f
lex
=
{f
k
}
N
2
k=1
,f
k
= f(x
k
) as follows:
A
D
u
lex
= f
lex
(4)
where A
D
is block tridiagonal:
A
D
=
1
h
2
A
1
A
0
A
0
A
1
A
0
.
.
.
.
.
.
.
.
.
A
0
A
1
A
0
A
0
A
1
,A
0
= −I,A
1
=
4 −1
−1 4 −1
.
.
.
.
.
.
.
.
.
−1 4 −1
−1 4
(5)
and A
0
and A
1
are N ×N blocks.
For the numerical solution of A
D
u
lex
= f
lex
we could begin by considering the simplest
Jacobi scheme in which
P
N
j=1
a
ij
u
j
= f
i
,1 ≤ i ≤ N,is rewritten in the following iterative form:
(u
i
)
n+1
=
1
a
ii
f
i
−
X
j6=i
a
ij
(u
j
)
n
,i = 1,...,N (6)
Note that the Jacobi scheme has the advantageous property that all components of u
n+1
can
be computed simultaneously without the computation of one component being dependent upon
another.This approach requires that u
n+1
and u
n
be stored separately.If the components
{u
j
}
i−1
j=1
are immediately overwritten after computing them,the Jacobi method becomes the
GaussSeidel method:
(u
i
)
n+1
=
1
a
ii
f
i
−
i−1
X
j=1
a
ij
(u
j
)
n+1
−
N
X
j=i+1
a
ij
(u
j
)
n
,i = 1,...,N (7)
This scheme typically has better convergence properties,in the sense that fewer iterations are
required to reach a given accuracy.However,the GaussSeidel scheme requires that {(u
j
)
n+1
}
i−1
j=1
1
ﬁrst be calculated before (u
i
)
n+1
can be.This scheme also has an asymmetrical aspect to it,
since unknowns are updated from 1 to N.If such a sweep from 1 to N is followed by a sweep
from N to 1,then the socalled symmetric GaussSeidel scheme is obtained.If the update is
weighted by (1 −ω) of the previous iterate and by ω of the new calculation,then symmetric
successive overrelaxation method (SSOR) is obtained:
(u
i
)
n+
1
2
= (1 −ω)(u
i
)
n
+
ω
a
ii
f
i
−
i−1
X
j=1
a
ij
(u
j
)
n+
1
2
−
N
X
j=i+1
a
ij
(u
j
)
n
,i = 1,...,N
(u
i
)
n+1
= (1 −ω)(u
i
)
n
+
ω
a
ii
f
i
−
i−1
X
j=1
a
ij
(u
j
)
n+
1
2
−
N
X
j=i+1
a
ij
(u
j
)
n+1
,i = N,...,1
(8)
where ω ∈ (0,2) is a socalled relaxation parameter.Note in the ﬁrst equation that the com
ponents (u
j
)
n+
1
2
for 1 ≤ j ≤ i − 1 are immediately overwritten by the most current values
obtained by this equation.After the computations of the ﬁrst equation are completed,the com
putations of the second equation are carried out.Note similarly in the second equation that
the components (u
j
)
n+1
for i + 1 ≤ j ≤ N are immediately overwritten by the most current
values obtained by this equation.These formulas can also be written more compactly in terms
of the splitting of A into its strictly diagonal part D,its stictly lower triangular part L and its
strictly upper triangular part U = L
T
,
A
D
= D+L +L
T
(9)
according to:
u
lex
n+
1
2
= (1 −ω)u
lex
n
+ωD
−1
f −Lu
lex
n+
1
2
−L
T
u
lex
n
u
lex
n+1
= (1 −ω)u
lex
n
+ωD
−1
f −Lu
lex
n+
1
2
−L
T
u
lex
n+1
(10)
or after solving for u
lex
n+1/2
and u
lex
n+1
respectively:
u
lex
n+
1
2
= (D+ωL)
−1
{[(1 −ω)D−ωL
T
]u
lex
n
+ωf
lex
}
= u
lex
n
+ω(D+ωL)
−1
[f
lex
−A
D
u
lex
n
]
u
lex
n+1
= (D+ωL
T
)
−1
{[(1 −ω)D−ωL]u
lex
n+
1
2
+ωf
lex
}
= u
lex
n+
1
2
+ω(D+ωL
T
)
−1
[f
lex
−A
D
u
lex
n+
1
2
]
(11)
From (8) it is apparent that the unknowns of u
lex
must be updated in a sequential fashion
using the lexicographic ordering.On the other hand,a degree of parallelism can be achieved
with the following redblack (in general,multicolor) ordering:
x
l
= x
k(l)
,k(l) =
(
2l −1,l = 1,...,N
2
/2
2l −N
2
,l = N
2
/2 +1,...,N
e.g.,
15
7
16
8
5
13
6
14
11
3
12
4
1
9
2
10
(12)
where x
k
is given by (3).Now with u
rb
= {u
l
}
N
2
k=1
,u
l
= u(x
l
) and f
rb
= {f
l
}
N
2
l=1
,f
l
= f(x
l
),
(1) is discretized as follows:
B
D
u
rb
= f
rb
(13)
2
where
B
D
=
1
h
2
B
2
B
1
B
0
B
2
B
0
B
T
1
B
0
.
.
.
.
.
.
.
.
.
.
.
.
B
2
B
0
B
1
B
0
B
2
B
0
B
T
1
B
T
1
B
0
B
2
B
0
B
1
B
0
B
2
.
.
.
.
.
.
.
.
.
.
.
.
B
0
B
T
1
B
0
B
2
B
0
B
1
B
2
B
2
= 4I,B
0
= −I,
B
1
=
−1
−1 −1
.
.
.
.
.
.
−1 −1
−1 −1
(14)
and B
0
,B
1
and B
2
are
N
2
×
N
2
blocks.With the redblack ordering,the SSOR method takes a
particularly simple form.For this let u
rb
and f
rb
be partitioned into red and black components:
u
R
= {u
l
}
N
2
/2
l=1
,u
B
= {u
l
}
N
2
l=N
2
/2+1
,f
R
= {f
l
}
N
2
/2
l=1
,f
B
= {f
l
}
N
2
l=N
2
/2+1
(15)
Also let B
D
be partitioned correspondingly,
B
D
=
"
D
0
L
T
0
L
0
D
0
#
(16)
Then the SSOR method can be written as:
(u
R
)
n+
1
2
= (1 −ω)(u
R
)
n
+ωD
−1
0
[f
R
−L
T
0
(u
B
)
n
]
(u
B
)
n+
1
2
= (1 −ω)(u
B
)
n
+ωD
−1
0
[f
B
−L
0
(u
R
)
n+
1
2
]
(u
B
)
n+1
= (1 −ω)(u
B
)
n+
1
2
+ωD
−1
0
[f
B
−L
0
(u
R
)
n+
1
2
]
(u
R
)
n+1
= (1 −ω)(u
R
)
n+
1
2
+ωD
−1
0
[f
R
−L
T
0
(u
B
)
n+1
]
(17)
where all elements of u
R
are updated simultaneously and then all elements of u
B
are updated
simultaneously.
An example of a solution to (1) is shown in the following ﬁgure for f = 10.
0
1
0
1
0
1
x
y
u
Since the nonlinear problems analyzed below involve boundary conditions diﬀerent than
seen in (1) we consider ﬁrst the following variation of the linear problem:
(
−Δu +u = f,Ω
∂u/∂n = 0,∂Ω
(18)
3
where the socalled homogeneous Dirichlet boundary condition is given in (1) and the homoge
neous Neumann boundary condition is given in (18).Note that without the zerothorder term
u in the operator −Δu+u,no unique solution would exist,since any constant could be added
to a potential solution u and the sum would still satisfy the equation.For (18),the matrix
formulation in (5) must be modiﬁed as follows:
A
N
=
h
2
A
1
A
0
A
0
A
2
A
0
A
0
A
3
A
0
.
.
.
.
.
.
.
.
.
A
0
A
3
A
0
A
0
A
2
A
0
A
0
A
1
+I
A
0
= −I,A
1
=
2 −1
−1 3 −1
.
.
.
.
.
.
.
.
.
−1 3 −1
−1 2
,A
2
=
3 −1
−1 4 −1
.
.
.
.
.
.
.
.
.
−1 4 −1
−1 3
(19)
and A
0
,A
1
and A
2
are N ×N blocks.This discretization can be conceived by constructing a
layer of ghost cells just outside of Ω,say with centers (x
κ
,y
λ
),where at least one of the cases
{κ = 0 or N +1,λ = 0 or N +1} hold.Let (x
k
,y
l
) be the center of the cell within Ω which is
nearest to (x
κ
,y
λ
).Then u
κ,λ
= u
k,l
must hold because of the Neumann boundary condition
u
n
= 0.So the usual stencil,h
2
u
xx
(x
1
,y
1
) ≈ u
2,1
− 2u
1,1
+u
0,1
= [u
2,1
−u
1,1
] − [u
1,1
−u
0,1
]
becomes u
2,1
−u
1,1
since u
1,1
−u
0,1
= 0 holds in terms of the ghost cell value u
0,1
.
To obtain the discretization of (18) with redblack ordering,the matrix formulation in (14)
must be modiﬁed as follows:
B
N
=
h
2
B
2
B
1
B
0
B
3
B
0
B
T
1
B
0
B
4
B
0
B
1
B
0
.
.
.
.
.
.
.
.
.
.
.
.
B
3
B
0
B
T
1
B
0
B
4
B
0
B
1
B
0
B
5
B
0
B
T
1
B
T
1
B
0
B
5
B
0
B
1
B
0
B
4
B
0
B
T
1
B
0
B
3
.
.
.
.
.
.
.
.
.
.
.
.
B
0
B
1
B
0
B
4
B
0
B
T
1
B
0
B
3
B
0
B
1
B
2
+I (20)
4
B
2
=
2
3
.
.
.
3
,B
3
=
4
.
.
.
4
3
,B
4
=
3
4
.
.
.
4
B
5
=
3
.
.
.
3
2
B
1
=
−1
−1 −1
.
.
.
.
.
.
−1 −1
−1 −1
B
0
= −I
(21)
where B
0
,B
1
,B
2
,B
3
,B
4
and B
5
are
N
2
×
N
2
blocks.Again,B
N
has the same partitioning as
in (16),
B
N
=
"
D
0
L
T
0
L
0
D
0
#
D =
"
D
0
D
0
#
(22)
and,by writing (1−ω)(u
R
)
n
+ωD
−1
0
[f
R
−L
T
0
(u
B
)
n
] in (17) as (u
R
)
n
+ωD
−1
0
[f
B
−D
0
(u
R
)
n
−
L
T
0
(u
B
)
n
] or equivalently as (u
R
)
n
+ωD
−1
0
[f −B
D
(u)
n
]
B
the ﬁrst step of the SSOR method
applied for B
N
can be written similarly in the form:
P
R
u
n+
1
2
= P
R
u
n
+ωP
R
D
−1
P
R
[f −B
N
u
n
] (23)
where P
R
and P
B
are projections onto red and black cells,respectively,i.e.,P
R
is 1 on red cells
and zero on black cells and P
B
= 1 − P
R
.Note that with these projections,B
N
could even
be replaced by A
N
in (23),provided D is replaced by the diagonal of A
N
.This rather mobile
structure of (23) suggests to formulate the iteration independently of the matrix structure.This
can be done using stencil formulas as follows.
Now let u = {u
ij
} denote the twodimensional array of cell values where u
ij
≈ u(x
i
,y
j
).
Then let a diﬀerential operator be approximated by a discrete operator,
Lu =
X
k,l≤r
σ
k,l
S
k,l
u (24)
where S
k,l
is a shift operator which wraps at the boundary as illustrated below in (30),
(S
k,l
u)
i,j
= u
⌊i+k⌉,⌊j+l⌉
,⌊i +k⌉ =
i +k +N,i +k < 1
i +k,1 ≤ i +k ≤ N
i +k −N,N < i +k
(25)
Also the stencil at each cell (x
i
,y
j
) consists of weights {(σ
i,j
)
k,l
}
k,l≤r
in the sumof neighboring
cells {(x
i+k
,y
j+l
):k,l ≤ r} in (24).For instance,the weights corresponding to (2) at non
boundary cells are σ
±1,0
= σ
0,±1
= −1/h
2
and σ
0,0
= +4/h
2
.These weights must be modiﬁed
at the boundary depending upon whether Dirichlet or Neumann boundary conditions are used.
Speciﬁcally,for Dirichlet boundary conditions the stencils at the corner cells {(x
i
,y
j
):1 ≤
i,j,≤ 2} are obtained by dividing the following by h
2
:
+
0
−1
0
0
−1
0
(x
1
,y
2
):
0
4
−1
(x
2
,y
2
):
−1
4
−1
0
−1
0
0
−1
0
+
0
−1
0
0
−1
0
(x
1
,y
1
):
0
4
−1
(x
2
,y
1
):
−1
4
−1
0
0
0
0
0
0
(26)
5
and the stencils for other boundary cells are given similarly.For Neumann boundary conditions
the stencils at the corner cells {(x
i
,y
j
):1 ≤ i,j,≤ 2} are obtained by dividing the following by
h
2
:
+
0
−1
0
0
−1
0
(x
1
,y
2
):
0
3
−1
(x
2
,y
2
):
−1
4
−1
0
−1
0
0
−1
0
+
0
−1
0
0
−1
0
(x
1
,y
1
):
0
2
−1
(x
2
,y
1
):
−1
3
−1
0
0
0
0
0
0
(27)
and the stencils for other boundary cells are given similarly.
With the Dirichlet or Neumann problem so formulated,(23) can be written as:
P
R
u
n+
1
2
= P
R
u
n
+ωP
R
σ
−1
0,0
P
R
[f −Lu
n
] (28)
Note that P
R
Lu can be written as:
P
R
Lu =
X
k+l≤1
P
R
σ
k,l
P
R
S
k,l
u (29)
Instead of processing many zero values resulting from projections in such an equation,we deﬁne
the index set I
k,l
R
so that u(I
k,l
R
) is the set of nontrivial red cell values of P
R
S
k,l
u.In particular,
let I
R
= I
0,0
R
so that u(I
R
) is the set of nontrivial red cell values in P
R
u.Explicitly,with respect
to the sample grid of (12),{I
±1,±1
R
} are the index sets for the following sets of cells:
I
−1,0
R
:
(1,4)
R
(3,4)
R
(4,3)
R
(2,3)
R
(1,2)
R
(3,2)
R
(4,1)
R
(2,1)
R
(4,1)
I
+1,0
R
:
(1,4)
R
(3,4)
R
(1,4)
R
(2,3)
R
(4,3)
R
(3,2)
R
(1,2)
R
(2,1)
R
(4,1)
I
0,−1
R
:
R
R
R
(2,3)
R
(4,3)
(1,2)
R
(3,2)
R
R
(2,1)
R
(4,1)
(1,4)
(3,4)
I
0,+1
R
:
(2,1)
(4,1)
(1,4)
R
(3,4)
R
R
(2,3)
R
(4,3)
(1,2)
R
(3,2)
R
R
R
(30)
where the red cells above correspond to the index set,
I
0,0
R
= I
R
:
(2,4)
(4,4)
(1,3)
(3,3)
(2,2)
(4,2)
(1,1)
(3,1)
(31)
Deﬁne I
k,l
B
and I
B
= I
0,0
B
similarly with respect to black cell values.With these constructions,
(29) can be written as:
(Lu)(I
R
) =
X
k+l≤1
σ
k,l
(I
R
)u(I
k,l
R
) (32)
and so (28) can be written as:
u
n+
1
2
(I
R
) = u
n
(I
R
) +
ω
σ
0,0
(I
R
)
f(I
R
) −
X
k+l≤1
σ
k,l
(I
R
)u(I
k,l
R
)
(33)
6
with the terms corresponding to those remaining in (17) written similarly.
An example of a solution u to (18) is shown on the right in the following ﬁgure next to (a
noisy image) f shown in the middle and an ideal image u
∗
shown on the left.
exact image u
*
corrupted image f
estimated image u
This problem is a special case of minimizing the functional in (34) below for no blurring K =I
and for regularization φ(s) = s.The result can be improved for other choices of φ.
So what we really want to do is to minimize functionals such as the following,
J(u) =
Z
Ω
[Ku − ˜u]
2
dx +
Z
Ω
φ(∇u
2
)dx (34)
where ˜u is a given noisy and blurred image.Blurring is modeled by the convolution operator
K,
[Ku](x) =
Z
Ω
κ(x −y)u(y)dy (35)
deﬁned in terms of a socalled pointspread function κ such as
κ(z) =
(
(2ǫ)
−d
,z < ǫ
0,else
(d = 2) (36)
For instance,note the following eﬀect of the operator K in the onedimensional case when u is
a step function:
1
e
e
1
0
1
x
u, Ku
u
Ku
Speciﬁcally,K smoothes the step function to be linear between −ǫ and ǫ.Applying K again
would create a function K
2
u which is smoothly quadratic between −2ǫ and 2ǫ.In other words,
K has a smoothing eﬀect which leads to a blur of Ku in relation to u.We assume also that
κ(z) = κ(−z) holds,so the operator K is symmetric,
Z
Ω
vKudx =
Z
Ω
uKvdx.(37)
Possible choices for the penalty function φ are φ(s) = s
p/2
,1 ≤ p ≤ 2,where edges are
particularly well captured by p = 1 and gradual slopes are better captured by p = 2.Thus,a
7
function φ which is closer to the case p = 1 when s is large (∇u
2
is large) and closer to the
case p = 2 when s is small (∇u
2
is small) is ideal.Speciﬁcally,we might take φ according to:
φ
ǫ
(s) =
(
s/(2
√
ǫ),0 ≤ s ≤ ǫ
√
s −
√
ǫ/2,s ≥ ǫ
φ
′
ǫ
(s) =
2max{ǫ,s}
(38)
The minimizer u of J must satisfy the necessary optimality condition with respect to any
suﬃciently smooth perturbation ¯u,
0 =
1
2
δJ
δu
(u;¯u) =
1
2
lim
ǫ→0
d
dǫ
J(u +ǫ¯u) =
Z
Ω
[Ku − ˜u]K¯udx +
Z
Ω
φ
′
(∇u
2
)(∇u ∇¯u)dx
=
Z
Ω
[K
2
u −K˜u]¯udx +
Z
∂Ω
¯uφ
′
(∇u
2
)(∇u n)dS(x) −
Z
Ω
¯u∇ [φ
′
(∇u
2
)∇u]dx
(39)
Note that the last two integrals emerge from partial integration.Also,n denotes the unit
normal vector which is outwardly directed at ∂Ω.So the normal derivative of u at ∂Ω is given
by ∂u/∂n = ∇u n.The directional derivatives of J are now given succinctly by:
0 =
1
2
δJ
δu
(u;¯u) =
Z
Ω
¯u
n
K
2
u −K˜u −∇ [φ
′
(∇u
2
)∇u]
o
dx +
Z
∂Ω
¯uφ
′
(∇u
2
)
∂u
∂n
dS(x) (40)
Since these directional derivatives must be zero for all suﬃciently smooth perturbations ¯u,
letting the perturbation ¯u be concentrated at points in Ω or on ∂Ω leads to the following
pointwise characterization of the minimizer u:
(
−∇ [φ
′
(∇u
2
)∇u] +K
2
u = K˜u,Ω
∂u/∂n = 0,∂Ω
(41)
Since this problem is nonlinear we apply Newton’s method.In the function space setting,
Newton’s method takes the form:
δ
2
J
δu
2
(u
m
;¯u,δu) = −
δJ
δu
(u
m
;¯u),u
m+1
= u
m
+αδu (42)
where α may be chosen by a line search to minimize f(α) = J(u+αδu),and the second variation
of J is given by:
1
2
δ
2
J
δu
2
(u;¯u
1
,¯u
2
) =
1
2
lim
ǫ→0
d
dǫ
δJ
δu
(u +ǫ¯u
2
;¯u
1
) =
Z
Ω
K¯u
1
K¯u
2
dx +
Z
Ω
h
φ
′
(∇u
2
)(∇¯u
1
∇¯u
2
) +φ
′′
(∇u ∇¯u
1
)(∇u ∇¯u
2
)
i
dx
(43)
In order to guarantee the positivity of the second derivative operator to be inverted,we neglect
the term with φ
′′
whose positivity is not assured;see,e.g.,(38).Thus,the second variation of
J is approximated according to:
1
2
δ
2
J
δu
2
(u;¯u,δu) ≈
Z
Ω
¯u
h
K
2
δu −∇ [φ
′
(∇u
2
)∇δu]
i
dx +
Z
∂Ω
¯uφ
′
(∇u
2
)
∂δu
∂n
dS(x) (44)
As with (40) and (41),letting the perturbation ¯u in (44) be concentrated at points in Ω or on
∂Ω leads to the following pointwise characterization of the Newton update δu deﬁned in (42):
−∇ [φ
′
(∇u
m

2
)∇δu] +K
2
δu = ∇ [φ
′
(∇u
m

2
)∇u
m
] −K
2
u
m
+K˜u,Ω
∂δu/∂n = 0,∂Ω
u
m+1
= u
m
+αδu,m= 0,1,2,...
u
0
= ˜u
(45)
8
In analogy with (2),∇ [φ
′
(∇u
2
)∇v] is discretized as follows:
1
h
φ
′
i+
1
2
,j
v
i+1,j
−v
i,j
h
−φ
′
i−
1
2
,j
v
i,j
−v
i−1,j
h
+
1
h
φ
′
i,j+
1
2
v
i,j+1
−v
i,j
h
−φ
′
i,j−
1
2
v
i,j
−v
i,j−1
h
≈ ∇ [φ
′
(∇u
2
)∇v](x
i
,y
j
)
(46)
where:
φ
′
i±
1
2
,j
= φ
′
u
i±1,j
−u
i,j
h
2
+
u
i,j+1
−u
i,j−1
+u
i+1,j+1
−u
i+1,j−1
4h
2
!
(47)
and:
φ
′
i,j±
1
2
= φ
′
u
i,j±1
−u
i,j
h
2
+
u
i+1,j
−u
i−1,j
+u
i+1,j+1
−u
i−1,j+1
4h
2
!
(48)
Note that the ﬁrst diﬀerence quotient in (47) approximates u
x
at (x
i±
1
2
,y
j
) and the second
diﬀerence quotient approximates u
y
at (x
i±
1
2
,y
j
).Then in (48) the ﬁrst diﬀerence quotient
approximates u
y
at (x
i
,y
j±
1
2
) and the second diﬀerence quotient approximates u
x
at (x
i
,y
j±
1
2
).
Writing this discretization in the lexicographic ordering as in (19) leads to:
A(u) =
1
h
2
D
1
L
1
L
1
D
2
L
2
L
2
D
3
L
3
.
.
.
.
.
.
.
.
.
L
N−3
D
N−2
L
N−2
L
N−2
D
N−1
L
N−1
L
N−1
D
N
(49)
where:
L
j
= −
φ
′
1,j+
1
2
φ
′
2,j+
1
2
.
.
.
φ
′
N−1,j+
1
2
φ
′
N,j+
1
2
(50)
D
1
=
φ
′
1,1+
1
2
+φ
′
1+
1
2
,1
−φ
′
1+
1
2
,1
−φ
′
1+
1
2
,1
φ
′
2±
1
2
,1
+φ
′
1,1+
1
2
−φ
′
2+
1
2
,1
.
.
.
.
.
.
.
.
.
−φ
′
N−1−
1
2
,1
φ
′
N−1±
1
2
,1
+φ
′
N−1,1+
1
2
−φ
′
N−
1
2
,1
−φ
′
N−
1
2
,1
φ
′
N,1+
1
2
+φ
′
N−
1
2
,1
(51)
D
N
=
φ
′
1,N−
1
2
+φ
′
1+
1
2
,N
−φ
′
1+
1
2
,N
−φ
′
1+
1
2
,N
φ
′
2±
1
2
,N
+φ
′
1,N−
1
2
−φ
′
2+
1
2
,N
.
.
.
.
.
.
.
.
.
−φ
′
N−1−
1
2
,N
φ
′
N−1±
1
2
,N
+φ
′
N−1,N−
1
2
−φ
′
N−
1
2
,N
−φ
′
N−
1
2
,1
φ
′
N,N−
1
2
+φ
′
N−
1
2
,N
(52)
and for 1 < j < N,
D
j
=
φ
′
1,j±
1
2
+φ
′
1+
1
2
,j
−φ
′
1+
1
2
,j
−φ
′
1+
1
2
,j
φ
′
2±
1
2
,j
+φ
′
1,j±
1
2
−φ
′
2+
1
2
,j
.
.
.
.
.
.
.
.
.
−φ
′
N−1−
1
2
,j
φ
′
N−1±
1
2
,j
+φ
′
N−1,j±
1
2
−φ
′
N−
1
2
,j
−φ
′
N−
1
2
,j
φ
′
N,j±
1
2
+φ
′
N−
1
2
,j
(53)
9
Note that in these formulas for D
1
,D
j
and D
N
as well as in the stencils below involving φ
′
,
φ
′
i,j±1/2
,for instance,denotes the sum of φ
′
i,j+1/2
and φ
′
i,j−1/2
.The convolution operator can
be discretized in the lexicographic ordering as:
K =
1
8
K
1
K
0
K
0
K
2
K
0
K
0
K
2
K
0
.
.
.
.
.
.
.
.
.
K
0
K
2
K
0
K
0
K
2
K
0
K
0
K
1
K
0
= I,K
1
=
6 1
1 5 1
.
.
.
.
.
.
.
.
.
1 5 1
1 6
,K
2
=
5 1
1 4 1
.
.
.
.
.
.
.
.
.
1 4 1
1 5
(54)
and K
0
,K
1
and K
2
are N ×N blocks.Thus,(45) is fully discretized as follows:
[A(u
lex
m
) +K
2
]δu
lex
= −[(A(u
lex
m
) +K
2
)u
lex
m
−K˜u
lex
]
u
lex
m+1
= u
lex
m
+δu
lex
,m= 0,1,...,u
lex
0
= ˜u
(55)
On the other hand,the complications of formulating the matrix A(u) +K
2
can be avoided
by discretizing (45) in the manner of (24).For example the corresponding stencils for the
approximation of −∇ [φ
′
(∇u
2
)∇v] are given at ﬁeld cells by dividing the following by h
2
:
(x
i
,y
j
):
0
−φ
′
i,j+
1
2
0
−φ
′
i−
1
2
,j
φ
′
i±
1
2
,j
+φ
′
i,j±
1
2
−φ
′
i+
1
2
,j
0
−φ
′
i,j−
1
2
0
(56)
and the stencils are given at the corner cells {(x
i
,y
j
):1 ≤ i,j,≤ 2} by dividing the following
by h
2
:
(x
1
,y
2
):(x
2
,y
2
):
0
−φ
′
1,2+
1
2
0
0
φ
′
1+
1
2
,2
+φ
′
1,2±
1
2
−φ
′
1+
1
2
,2
0
−φ
′
1,2−
1
2
0
0
−φ
′
2,2+
1
2
0
−φ
′
2−
1
2
,2
φ
′
2±
1
2
,2
+φ
′
2,2±
1
2
−φ
′
2+
1
2
,2
0
−φ
′
2,2−
1
2
0
(x
1
,y
1
):(x
2
,y
1
):
0
−φ
′
1,1+
1
2
0
0
φ
′
1,1+
1
2
+φ
′
1+
1
2
,1
−φ
′
1+
1
2
,1
0
0
0
0
−φ
′
2,1+
1
2
0
−φ
′
2−
1
2
,1
φ
′
2,1+
1
2
+φ
′
2±
1
2
,1
−φ
′
2+
1
2
,1
0
0
0
(57)
with stencils for other boundary cells given similarly.Note that the symmetry of the discretiza
tion can be seen from the identical weights in adjacent stencil entries,e.g.,between (x
1
,y
1
)
and (x
2
,y
1
),φ
′
1,1+1/2
= φ
′
1,2−1/2
.Now in the manner of (24) deﬁne the discretization of the
secondorder operator −∇ [φ
′
(∇u
2
)∇v] by L
2
(u)v using the stencils shown above.Similarly,
the stencils for the approximation of Kv are given at the corner cells {(x
i
,y
j
):1 ≤ i,j ≤ 2} by
10
dividing the following by 8,
+
0
+1
0
0
+1
0
(x
1
,y
2
):
0
5
+1
(x
2
,y
2
):
+1
4
+1
0
+1
0
0
+1
0
+
0
+1
0
0
+1
0
(x
1
,y
1
):
0
6
+1
(x
2
,y
1
):
+1
5
+1
0
0
0
0
0
0
(58)
and the stencils for other cells are given similarly.Then in the manner of (24) deﬁne the
discretization of the zerothorder operator Kv by L
0
v using the stencils shown above.So the
discrete approximation to the full operator −∇ [φ
′
(∇u
2
)∇v] + K
2
v is given by L(u)v =
L
2
(u)v +L
2
0
v written as follows:
L(u)v =
X
k,l≤1
σ
k,l
(u)S
k,l
v (59)
Thus,(45) is fully discretized as follows:
L(u
m
)δu = −[L(u
m
)u
m
−L
0
˜u],u
m+1
= u
m
+δu,m= 0,1,2,...,u
0
= ˜u (60)
which can be solved in the manner of (33),
δu
n+1
(I
R
) = δu
n
(I
R
) +
ω
σ
0,0
(I
R
)
f(I
R
) −
X
k+l≤1
σ
k,l
(I
R
)δu(I
k,l
R
)
δu
n+1
(I
B
) = δu
n
(I
B
) +
ω
σ
0,0
(I
B
)
f(I
B
) −
X
k+l≤1
σ
k,l
(I
B
)δu(I
k,l
B
)
(61)
with f = −[L(u
n
)u
n
−L
0
˜
u].
An example of a solution to (41) is shown on the right in the following ﬁgure next to (a
blurred and noisy image) ˜u shown in the middle and an ideal image u
∗
shown on the left.
exact image u
*
corrupted image u
~
estimated image u
This manner of formulating discretizations in terms of stencils is quite modular as can be
seen from the following problem.Now u and v are given images which are not smooth,i.e.,
they possess edges where the intensity is discontinuous as seen in the ﬁgure below.On the
other hand,the quotient of the two images is quite smooth.We want to estimate the smooth
modulation s to satisfy su ≈ v.This is done by minimizing:
J(s) =
Z
Ω
[su −v]
2
dx +ν
X
α=2
2!
α!
!
Z
Ω
∂
α
s
2
dx (62)
11
where the sum over the multiindex α gives the Frobenius norm of the Hessian of s as the
integrand.The optimality condition for the minimizer s is that it satisfy:
(
νΔ
2
s +u
2
s = uv,Ω
s
nnn
= s
nn
= s
nτ
= 0,∂Ω
(63)
where s
n
is the normal derivative of s and s
τ
is the tangential derivative of s at ∂Ω.The
discretization of the biharmonic operator Δ
2
is given for the corner cells {(x
i
,y
j
):1 ≤ i,j ≤ 3}
by dividing the following by 2800h
4
,
0 0 −152 424 208 0 424 920 848 208 208 848 768 848 208
0 0 −592 −2176 848 0 −2176 −3920 −4352 848 848 −4352 −4512 −4352 848
0 0 4368 −2256 768 0 −2256 20400 −4512 768 768 −4512 24768 −4512 768
0 0 −592 −2176 848 0 −2176 −3920 −4352 848 848 −4352 −4512 −4352 848
0 0 −152 424 208 0 424 920 848 208 208 848 768 848 208
0 0 −152 424 208 0 424 920 848 208 208 848 768 848 208
0 0 −592 −2176 848 0 −2176 −3920 −4352 848 848 −4352 −4512 −4352 848
0 0 3440 −1960 920 0 −1960 16960 −3920 920 920 −3920 20400 −3920 920
0 0 −296 −1088 424 0 −1088 −1960 −2176 424 424 −2176 −2256 −2176 424
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 −152 424 208 0 424 920 848 208 208 848 768 848 208
0 0 −296 −1088 424 0 −1088 −1960 −2176 424 424 −2176 −2256 −2176 424
0 0 928 −296 −152 0 −296 3440 −592 −152 −152 −592 4368 −592 −152
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(64)
Let the corresponding discretization of νΔ
2
with the natural boundary conditions by denoted by
L
4
.The discretization of the zerothorder operator L
0
,given by multiplication by u
2
,is obtained
by a single stencil weight of u
2
i,j
at the center of each stencil.So the discrete approximation
to the full operator νΔ
2
+u
2
is given by L = L
4
+L
0
which can be written in the form (24).
Thus,the discrete solution s to (63) satisﬁes:
Ls = uv (65)
To solve this linear system iteratively requires to modify an iteration such as (33) so that it
involves nine separate colors,since this is the minimum number such that all cells of one color
may be updated simultaneously in terms of cells of other colors:
c = 1,...,9
u
n+1
(I
c
) = u
n
(I
c
) +
ω
σ
0,0
(I
c
)
u(I
c
)v(I
c
) −
X
k+l≤3
σ
k,l
(I
c
)u(I
k,l
c
)
(66)
Speciﬁcally,all nine cells {(x
i
,y
j
):1 ≤ i,j ≤ 3} would have distinct colors,and then every cell
at three horizontal or vertical steps away from a given cell would have the same color.
An example of a solution to (63) is shown on the right in the following ﬁgure next to the
given images u and v shown respectively on the left and in the middle.
input image u
input image v
modulation s
12
Σχόλια 0
Συνδεθείτε για να κοινοποιήσετε σχόλιο