Download Exercise 3.

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Equation wikipedia , lookup

Homogeneous coordinates wikipedia , lookup

Corecursion wikipedia , lookup

Transcript
521467S Digital Image Processing
Exercise 3.
1. The adaptive, local noise reduction filter is defined as
fˆ(x, y) = g(x, y) − min(1,
ση2
) [g(x, y) − mL ] ,
σL2
(1)
where ση2 is an estimate of the noise variance, and mL and σL2 are
the mean and variance of the neighborhood of point (x, y). Here we
use window neighborhood size 3 × 3 and the estimated noise variance
ση2 = 0.5
Now, at point (1, 1),
g(1, 1) = 4
1
mL =
[2 + 3 + 2 + 1 + 4 + 2 + 2 + 2 + 3] = 21/9 = 2.3333 . . .
9
n
1 X
σL2 = s2 =
(xi − mL )2
(2)
n − 1 i=1
σL2 =
1h
(2 − 21/9)2 + (3 − 21/9)2 + (2 − 21/9)2 +
8
(1 − 21/9)2 + (4 − 21/9)2 + (2 − 21/9)2 +
i
(2 − 21/9)2 + (2 − 21/9)2 + (3 − 21/9)2 = 6/8 = 0.75
ση2
σL2
0.5
2
= < 1, and therefore
0.75
3
2
fˆ(1, 1) = 4 − [4 − 2.3333] = 2.8888 . . . ≈ 3
3
=
Similarly
fˆ(1, 2) = 2.2105 ≈ 2
fˆ(1, 3) = 5.9394 ≈ 6
and at point (1, 4)
g(1, 4) = 7
mL = 6.8888 . . .
σL2 = 0.361111 . . .
ση2
0.5
=
≈ 1.38 > 1, so
2
0.36111
σL
fˆ(1, 4) = 7 − [7 − 6.8889] = 6.8889 . . . ≈ 7
The resulting image is
1
3
2
6
7
2. The Wiener filter is
|H(u, v)|2
1
F̂ (u, v) =
G(u, v),
H(u, v) |H(u, v)|2 + Sη (u, v)/Sf (u, v)
"
#
in which Sη (u, v)/Sf (u, v) is to be replaced by constant L in our case.
Thus we get the equation
"
|H(u, v)|2
1
G(u, v)
H(u, v) |H(u, v)|2 + L
"
1
H(u, v)H ∗ (u, v)
G(u, v)
H(u, v) |H(u, v)|2 + L
"
H ∗ (u, v)
G(u, v)
|H(u, v)|2 + L
F̂ (u, v) =
=
=
#
#
#
2
2 5/6
The given degradation transfer function H(u, v) = e−k(u +v ) is real
and positive with all u, v, so H ∗ (u, v) = |H(u, v)| = H(u, v). Plugging
this into the Wiener filter equation we get

F̂ (u, v) =  h

"
F̂ (u, v) =

2
2 5/6
e−k(u +v )
−k(u2 +v 2 )5/6
e
i2
+L
2 +v 2 )5/6
e−k(u
5/6
e−2k(u2 +v2 )
+L

 G(u, v)
#
G(u, v)
3. (a) The coordinates are rounded to the nearest integer coordinates.
The interpolated value is the value of the pixel in these coordinates.
• (0.4, 0.4): Nearest integer coordinates (0, 0), interpolated value
2.
• (1.4, 1.7): Nearest integer coordinates (1, 2), interpolated value
5.
(b) One way to bilinearly interpolate pixel values is described in the
lecture material. The method explained here leads to the same
result.
The pixel to be interpolated (red) is placed on the original image. The interpolated value is computed using values of the four
neighbors. Weights of the neighboring pixels are proportional to
overlapping area.
2
• (0.4, 0.4):
0.6×0.6×2+0.6×0.4×3+0.4×0.6×3+0.4×0.4×4 = 2.8 ≈ 3
• (1.4, 1.7):
0.3×0.6×4+0.7×0.6×5+0.3×0.4×7+0.7×0.4×3 = 4.5 ≈ 5
4. If the color balance is correct, rR ≈ rG ≈ rB for white and black (and
gray) test targets. In our case the histogram peak corresponding to
black target is rR = 62, rG = 31, rB = 12, so color balance correction
is needed.
There are several possible color transformations that meet the requirements. Let us use a linear transformation
si = ai ri + bi
In the input image, the peak corresponding to black has rR = 62 and
we want to get sR = 16. For the white peak, rR = 242 and sR = 242.
From these we get the equation pair
16 = 62aR + bR
242 = 242aR + bR
and solving this gives
aR = 1.2556
bR = −61.8444
Next we need to check limits so that the output sR is in [0, 255] when
input rR is between 0 and 255.
sR < 0 ≡ rR < 49.2566
sR > 255 ≡ rR > 252.354
3
So the color transformation for the red channel is


 0,
rR < 50
1.2556rR − 61.8444, 50 ≤ rR ≤ 252
sR =

 255,
rR > 252
With the same procedure we get for green channel


 0,
rG < 17
1.0762rG − 17.3619, 17 ≤ rG ≤ 253
sG =

 255,
rG > 253
and for blue channel
(
sB =
rB + 4, 0 ≤ rB ≤ 251
255,
rB > 251
5. Each pixel in the input image contains a value only for a single channel.
These values are laid out in the input image as follows:
G
R
G
R
..
.
B
G
B
G
G
R
G
R
B
G
B
G
G
R
G
R
...
...
...
...
1st phase: Separate color channels
0
gG
(x, y) =
0
gR
(x, y)
0
gB
(x, y)


 f (x, y),
f (x, y),

 0,
(
f (x, y),
0,
when x = 2n + 1 and y = 2m
otherwise
(
f (x, y),
0,
when x = 2n and y = 2m + 1
otherwise
=
=
when x = 2n and y = 2m
when x = 2n + 1 and y = 2m + 1
otherwise
With any integer n, m.
After the 1st phase we have the three separate channels:
4
G
0
G
gG :
0
..
.
0
G
0
G
G
0
G
0
0
G
0
G
G
0
G
0
...
...
...
...
0
R
gR : 0
R
..
.
0
0
0
0
0
R
0
R
0
0
0
0
0
R
0
R
...
...
...
...
0
0
gB : 0
0
..
.
B
0
B
0
0
0
0
0
B
0
B
0
0
0
0
0
...
...
...
...
2nd phase: Interpolate the missing values by linear filtering
0
gR = gR
∗ wR
0
gG = gG
∗ wG
0
gB = gB
∗ wB

wR = wB

wG

0.25 0.5 0.25


1
0.5 
=  0.5
0.25 0.5 0.25

0
0.25
0


1
0.25 
=  0.25
0
0.25
0
5