EQ2330 – Image and Video Processing
Solution #2
Solution
1. Averaging filter and weighted averaging filter are linear filters and can be im-
plemented by convolving the image with a spatial filter mask.
Example:
1 1 1
Averaging filter h1 = 91 1 1 1
1 1 1
1 1 1
1
Weighted averaging filter h2 = 12 1 4 1 .
1 1 1
A down-sampling filter
(2:1 image size reduction) is specified by the following
0.5 0
0.5 0
matrices Hx = Hy = 0 0.5 . Let f be a 4 × 4 matrix representing the im-
0 0.5
age. The down-sampling operation may be represented by matrix multiplication
according to g = Hy T fHx . It is a linear operation.
2. The output for unweighed averaging is simply x = 19 (73 + 172 + 59+ 166 + 170+
169 + 165) ≈ 108. The downsampling operation may be implemented by using
the down-sampling method from the previous problem. We use Hx and Hy to
obtain the following size-reduced image (pixel values are rounded to integers)
72 74
. (1)
88 125
3. The mask can be (for example) separated into two masks as
1
1 1
1 · 1 1 1 (2)
3 3
1
1
or
1
1
1 · 1 1 1 . (3)
9
1
It is easily seen that the pairs of 1 − D masks give identical result as the original
2−D mask.
4. By using the original mask of size n × n, we use n2 multiplications, n2 − 1
additions, and one additional multiplication for scaling. With the decomposed
mask, we use 2n multiplications, 2(n − 1) additions, and one additional mul-
tiplication for scaling. This gives us a reduced computational complexity of
n2 − 2n multiplications (which are generally much more time consuming than
additions) and n2 − 2n − 3 additions.
5. A 2−D impulse response is separable if it can be written as the following prod-
uct:
h(x, α, y, β) = hx (x, α)hy (y, β) (4)
A 2−D mask can be separated into two 1−D masks if it can be written as an
outer product of two vectors.
6. By a repetitive application of the averaging filter to an image, we obtain an
image with constant pixel values. The pixel value is the same as the mean pixel
value of the original image.
7. Solution 1 We may notice that the mean value of G is 0. We may use the
frequency argument to tell what is the mean pixel value of the result. Since
mean value of G is 0, the DC component of its discrete Fourier spectrum is also
0. We know that convolution of image and mask in the spatial (signal) domain
is equivalent to multiplication of corresponding discrete Fourier spectra. Af-
ter performing such a multiplication, the DC component of the discrete Fourier
spectrum of the result is 0, therefore the mean pixel value of the resulting image
is also 0.
Solution 2 We may write any image as a sum of two images. In particular, the
first image may have all its pixel values constant and equal to the mean of the
original image, the second image can be simply the mean-removed original im-
age. We use the argument of linearity of convolution. We apply the convolution
to a sum of images. We note that it is equivalent to summing the results of
convolving the filter mask and the first image convolving the filter mask with
the other image. We note that the result of first convolution is an image with
all pixels equal to 0 (neglecting the boundary effect). The second convolution
results in an image with mean equal to zero. Therefore, the mean value of the
result (after summation of the two images) is 0.