1.A 1/5 [ 1 3 4 7 8 11 10 14 12 17 15 19 17 20 17 15 10 7 3 ]
1.B 1/6 [ 1 4 8 11 10 15 12 19 14 23 17 27 19 25 20 18 9 ]
(Note: Reverse the kernel when doing convolution! If you didn't, you would get
1/6 [ 3 8 8 13 10 17 12 21 14 25 19 25 21 23 20 10 3 ], which is incorrect.)
1.C 1/30 [ 1 5 13 24 34 48 56 67 70 83 85 100 100 111 108 109 91 72 47 27 9 ]
1.D 1/5 [ 4 7 8 11 10 14 12 17 15 19 17 20 17 15 10 ]
1.E 1/5 [ 7 9 8 11 10 14 12 17 15 19 17 20 17 19 17 ]
1.F 1/5 [ 20/3 35/4 8 11 10 14 12 17 15 19 17 20 17 75/4 50/3 ]
2.A 2 (t = 1.5)
(Note: Reverse the kernel! The reversed kernel has value 1 at r=-0.5 and 0 at r=0.5
Also note that the box filter in this question is different from the one in the book -
the book puts the closed interval at r= -0.5 instead of 0.5)
1 (t = 2)
3 (t = 3.25)
2.B 1.5 (t = 1.5)
1 (t = 2)
2.5 (t = 3.25)
2.C 1.5 (t = 1.5)
1.5 (t = 2)
2 (t = 3.25)
2.D 1.625 (t = 1.5)
1.75 (t = 2)
1.9375 (t = 3.25)
3.A result of convolution: [ 0 0 1 3 3 1 1 2 2 2 2 2 1 0 1 2 1 0 0 0 ]
samples: [ 0 1 3 1 2 2 1 1 1 0 ] (choosing odd values)
3.B samples: [ 0 0 3 1 2 2 2 0 2 0 ] (choosing even values)
The result is similar to that in part (A). The kernel does a fine job
for doing this resampling.
3.C [ 0 3 1 2 1 2 0 ]
3.D Other possibilities are:
[ 0 3 2 2 0 1 0 ]
[ 0 1 1 2 2 1 0 ]
There are significant differences in the signals. The kernel doesn't do
well this time.
4.A [ 1 1 1 1 1 ]
[ 1 1 1 1 1 ]
1/25 [ 1 1 1 1 1 ]
[ 1 1 1 1 1 ]
[ 1 1 1 1 1 ]
4.B [ 1 4 6 4 1 ]
[ 4 16 24 16 4 ]
1/256 [ 6 24 36 24 6 ]
[ 4 16 24 16 4 ]
[ 1 4 6 4 1 ]
4.C [ 1 -1 2 -1 1 ]
[ -1 1 -2 1 -1 ]
1/4 [ 2 -2 4 -2 2 ]
[ -1 1 -2 1 -1 ]
[ 1 -1 2 -1 1 ]
4.D O(MMN) -
For every pixel in the result (M*M pixels) we have to sum over
the 1D neighborhood in X and then in Y, each requires O(N)
work. So, 2*M*M*N -> O(MMN).
4.E O(MMNN) -
For every pixel in the result (M*M), we have to look at the
N*N neighbors.
Question 5:
To make things easier, I will convert these to floating point (0-1)
and pre-multiply them. Beware, I am rounding liberally and using
fractions.
A = 255,192,64,127 -> 4/8, 3/8, 1/8, 4/8
B = 0,255,255,255 -> 0, 1, 1, 1
C = 0,255,255,192 -> 0, 6/8, 6/8, 6/8
Note that all of the results here are in premultiplied form.
5.A A over B = 4/8, 7/8, 5/8, 1 (note: this is a premultiplied result)
= 127, 224, 160, 255
5.B B over A = 0, 255, 255, 255
(since B is opaque, you don't see any of A)
5.C 127, 192, 128, 223
5.D 31, 216, 200, 223
5.E 127, 96, 32, 127
5.F 96, 72, 24, 96
5.G 0, 96, 96, 96