Dithering Operation and Color Quantization, Assignments of Engineering

Instructions for computing the output of a dithering operation using a given matrix and input image, as well as proving that the chromaticity coordinates of a linear combination of three given colors lie within the triangle formed by those colors in chromaticity space. Additionally, it covers encoding and decoding a grayscale image using a defined colormap and computing the empirical quantization snr for each channel.

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-65d
koofers-user-65d 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1. [3 points]
Compute the output of dithering operation using the dithering matrix
D=
486
103
527
and the algorithm described in the
“Keeping the Same Resolution” slide, assuming the following input:
1234
0123
9012
8901
5678
4567
3456
2345
9012
8901
7890
6789
7890
6789
5678
4567
1234
0123
9012
8901
5678
4567
3456
2345
Please show the result in a nice graphic form.
Here is what the original image looks like:
Here is the output of the dithering operation (0 means “off” or “black”) if the row/column
indices of the image start from 1 (the row/column indices of the dither matrix always start
from 1):
1 0 0 1 1 0 1 1 1 0 0 0
0 0 0 0 0 0 1 0 1 1 0 0
1 0 0 1 0 0 1 1 1 1 1 0
1 1 0 1 0 0 1 1 0 1 1 1
1 1 1 0 0 0 0 0 0 1 0 1
1 1 1 1 0 0 1 0 0 1 1 1
1 1 0 1 1 0 1 0 0 1 1 0
1 0 0 1 1 1 0 0 0 0 0 0
Here is what the dithered image looks like:
If the row/column indices of the image start from 0, this is the result:
pf3
pf4
pf5

Partial preview of the text

Download Dithering Operation and Color Quantization and more Assignments Engineering in PDF only on Docsity!

1. [3 points]

Compute the output of dithering operation using the dithering matrix D =

and the algorithm described in the

“Keeping the Same Resolution” slide, assuming the following input:

1 2 3 4 0 1 2 3 9 0 1 2 8 9 0 1

Please show the result in a nice graphic form.

Here is what the original image looks like:

Here is the output of the dithering operation (0 means “off” or “black”) if the row/column indices of the image start from 1 (the row/column indices of the dither matrix always start from 1):

1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0

Here is what the dithered image looks like: If the row/column indices of the image start from 0, this is the result:

Here is what the dithered image looks like in this case:

2. [3 points] Prove that the chromaticity coordinates of any linear combination (with positive coefficients) of three given colors lie in the triangle in chromaticity space which has the chromaticity coordinates of the three colors as vertices. (Hint: remember that, given N points, any linear combinations of such points with positive coefficients such that

∑ iN = 1 α i =^1 belongs to the convex closure of the N points).

Let ( x i , y zi , i ), i =1:3, be the three colors, and let ( x y z , , ) = ∑ i^3 = 1 α i ( x i , y zi , i )be a linear

combination of those colors, where the coefficients α i are positive. The chromaticity coordinate of the combination are

x y x x y z

y x y z

x y x y x

i i^ i^ i j j^ j^ j^ j

^

( +^ + )

=

α α

1

3

1

3

Let β j = α j ( x j + y j + xj ). We can rewrite the expression above as

x y

x y ix y x x y i i i i i i j j

i i^ i^ i j j

=

=

β

β

β β

1

3

1

3 1

3

1

3

where ( x i , yi ) are the chromaticity coordinates of ( x i , y zi , i ). Given that terms β i are

positive, the expression above is a convex combination of ( x i , yi ), and thus must lie

within the triangle having ( x i , yi ) as vertices.

3. [1 point] Suppose we encode a sequence of 18 frames using MPEG. Each frame in the sequence is encoded as I, B or P according to the following order: I B B P B I I P P B B P P B I I P I Derive the correct transmission and decoding order.

Here is what the resulting image looks like:

Here are the variances of the input channels: var (R) =4216; var (G) = 5786; var (B) =

  1. Here are the variances of the quantization errors: var (e (^) r ) = 4128; var (e (^) g ) = 4531; var (e (^) b ) = 7128. Here are the quantization SNR for the different channels: SNRr = 0. dB; SBRg = 1.0618 dB; SNRb = -1.9569 dB. 6. [4 points] Consider the two following grayscale images, the first one corresponding to frame n +1, the second one corresponding to frame n. 34 174 183 31 13 100 247 40 76 107 60 95 53 24 177 115 20 151 170 49 13 192 140 108 155 9 21 183 163 31 222 108 177 202 238 152 161 156 116 228 49 10 3 218 166 235 85 144 94 155 113 70 215 117 35 125 251 215 167 183 147 4 90 65 44 222 209 208 141 94 100 130 115 4 38 221 44 238 110 117 102 158 160 198 11 48 172 59 254 67 227 117 51 186 178 125 7 150 178 205 112 41 187 115 159 49 101 47 80 15 186 232 87 223 175 105 187 231 105 179 3 94 122 59 80 61 88 230 96 145 167 251 98 161 141 61 93 165 42 1 3 161 214 206 Image at frame n+ 184 126 25 167 89 37 141 212 168 250 246 89 174 187 37 14 106 249 34 71 109 66 101 147 20 176 108 14 157 163 47 8 185 135 112 74 10 21 184 158 24 229 105 179 198 240 150 148 158 111 229 46 14 9 225 173 238 82 147 19 158 107 72 216 124 38 130 256 212 163 178 148 111 86 62 44 227 208 204 147 91 103 137 172 8 33 217 51 244 113 110 99 161 161 193 247 52 167 58 250 62 229 110 48 193 185 129 190 155 177 202 112 44 184 116 160 43 98 49 184 22 190 235 87 229 180 109 182 225 108 174 105 94 119 66 84 59 82 135 92 139 174 244 155 Image at frame n Consider motion-based compensation, whereby for each macroblock of frame n +1 we look for a displacement vector with respect to frame n. Assume that we are considering macroblocks of size 4x4 (instead of 16x16). Using the formula in the Motion Vector Computation slide, compute the motion vector for the macroblock outlined with bold line in frame n , and compute the variance of the residual e(x,y) for such a macroblock. Assume we use search window W of size 3x3 (meaning that we are only looking for displacements d with d (^) x = (− 1 0 1, , ) and d (^) y = ( −1 0 1, , ) ).

Here is what the image at frame n+1 looks like:. Here is what the image at

frame n looks like:. The central macroblock in the frame n+1 comes from the block in frame n which is located one pixel to the left and one pixel below. Therefore, the displacement vector is d=(1,-1). [Note that I am assuming that the column index x of a pixel grows as we move right, and that the row index y grows as we move down].

The residual error for the central macroblock is e^ =

and its variance

is var(e)=22..