Laplacian in Image Processing
Laplacian in Image Processing
51
4
4
4
4
4
4
4
4
4
5
5
5
5
5
4
4
4
5
6
6
6
5
4
4
4
5
6
7
6
5
4
4
4
5
6
6
6
5
4
4
4
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
0
0
0
0
0
0
0
0
2. Assume that we have many noisy versions gi (x, y) of the same image f (x, y), i.e.
gi (x, y) = f (x, y) + i (x, y)
where the noise i is zero-mean and all point-pairs (x, y) are uncorrelated. Then we can
reduce noise by taking the mean of all the noisy images
M
1 X
gi (x, y).
g(x, y) =
M
i=1
Prove that
E{
g (x, y)} = f (x, y)
and
g2(x,y) =
1 2
M (x,y)
2
where (x,y)
is the variance of and g2(x,y) the variance of g(x, y).
2f
2f
+
.
x2
y 2
52
Exercise 2/06
k
X
nj
j=0
where rk is the normalized gray level, nk is the number of pixels having gray level k, and n is
the total number of pixels.
First we calculate the gray level histogram:
k
rk
nk
pr (rk ) = nk /n
0
0
8
0.125
1
0.143
0
0
2
0.286
0
0
3
0.429
0
0
4
0.571
31
0.484
5
0.714
16
0.250
6
0.857
8
0.125
7
1.0
1
0.016
0.125
0.125
0.125
0.125
0.609
0.859
0.984
1.000
Finally we round the obtained values for the actual gray levels rk :
s0k
0.143
0.143
0.143
0.143
0.571
0.857
1.000
1.000
So, the histogram equalization is done by mapping the gray levels k into the new gray levels k 0 :
k
k0
0
1
1
1
2
1
3
1
4
4
5
6
6
7
7
7
Resulting image:
4
4
4
4
4
4
4
4
4
6
6
6
6
6
4
4
4
6
7
7
7
6
4
4
4
6
7
7
7
6
4
4
4
6
7
7
7
6
4
4
4
6
6
6
6
6
4
4
4
4
4
4
4
4
4
4
2.
The noisy image is now given as
gi (x, y) =
f (x, y)
+ i (x, y),
| {z }
| {z }
| {z }
noisy image original image
noise
where noise has zero mean and it is uncorrelated.
1
1
1
1
1
1
1
1
Exercise 2/06
53
M
1 X
gi (x, y)
M
i=1
i=1
i=1
M
M
1 X
1 X
E {f (x, y)} +
M
M
i=1
i=1
!2
!2
M
M
1 X
1 X
n
o
=E
=
g2(x,y) = E (
g E {
g })2 = E
(f + i ) f
i
M
i=1
i=1
!2
M
M
M
M
M
X
X
X
X
X
1
1
2
i2 +
= 1
E{
}
+
E{i j }
E
i
i
j
i
| {z }
M2
M2
M2
| {z }
i=1
i=1
i=1
j=1, j6=i
=2
j=1, j6=i
=0
1 2
,
M
3.
We approximate the derivative in discrete case:
f (x, y)
' f (x, y) f (x 1, y)
x
By derivating again, we have
2 f (x, y)
' (f (x, y)f (x1, y))(f (x1, y)f (x2, y)) = f (x, y)2f (x1, y)+f (x2, y).
x2
This is equivalent to filtering with a mask [1, 2, 1]. The mask is most practically used symmetrically so that 2 is in the middle, rather than as in the formula above.
Thus
2 f (x, y) 2 f (x, y)
+
' f (x 1, y) + f (x + 1, y) + f (x, y 1) + f (x, y + 1) 4f (x, y),
x2
y 2
which corresponds to mask h(x, y):
1
1
4
1
1
1 X X
h(x, y)ej2(ux+vy)/N = (ej2u/N + ej2v/N + ej2u/N + ej2v/N 4)
N x= y=
N
1
[2 cos(2u/N ) + 2 cos(2v/N ) 4]
N
54
Exercise 2/06
And finally
1
(2 cos(2u/N ) + 2 cos(2v/N ) 4) F (u, v),
N
10
9
8
7
6
5
4
3
2
1
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
In the figure there is |H(u, 0)| in discrete and continuous case. Solid line: discrete case, i.e.
|H(u, 0)| = 2 2 cos(2u). Dotted line: continuous case, i.e. |H(u, 0)| = (2)2 u2 .
4.
Consider the following equation:
f (x, y) 52 f (x, y) = f (x, y) [f (x + 1, y) + f (x 1, y) + f (x, y + 1) + f (x, y 1) 4f (x, y)]
= 6f (x, y) [f (x + 1, y) + f (x 1, y) + f (x, y + 1) + f (x, y 1) + f (x, y)]
1
= 5{1.2f (x, y) [f (x + 1, y) + f (x 1, y) + f (x, y + 1) + f (x, y 1) + f (x, y)]}
5