Docsity

Sample Homework 4 - Introduction to Digital Image | ECE 178, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
HW #4
DUE: Wednesday, November 5, 2008 (by 5PM in the HW box)
Q1. Problem 3.14
Q2. Problem 3.16
Q3. Problem 3.29
Q4. Write a MATLAB program to reduce the effect of 1-bit quantization using “Floyd-Steinberg
Dithering Algorithm”. Compare your results with uniform quantization without dithering.
Comment on the differences. Use the “lena.gif” (See class website www.ece.ucsb.edu/∼manj/
ece178) to test your program.
In the “Floyd-Steinberg Dithering Algorithm” quantization error introduced at each pixel is
spread over the neighboring pixels as follows:
Quantization error observed at pixel (i, j) is diffused to the right, lower left, below and lower
right pixels with the following weights (7/16,3/16,5/16,1/16). Here, note that the weights
sum up to 1.
Pseudo-code for the algorithm:
for i = 1 to height
for j = 1 to width
I2(i,j) = Q(I(i,j));
error = I(x,y) −I2(x,y);
I(i,j+1) += 7*error/16;
I(i+1,j−1) += 3*error/16;
I(i+1,j) += 5*error/16;
I(i+1,j+1) += error/16;
1
pf2

Partial preview of the text

Download Sample Homework 4 - Introduction to Digital Image | ECE 178 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

HW

DUE: Wednesday, November 5, 2008 (by 5PM in the HW box)

Q1. Problem 3.

Q2. Problem 3.

Q3. Problem 3.

Q4. Write a MATLAB program to reduce the effect of 1-bit quantization using “Floyd-Steinberg Dithering Algorithm”. Compare your results with uniform quantization without dithering. Comment on the differences. Use the “lena.gif” (See class website www.ece.ucsb.edu/∼manj/ ece178) to test your program. In the “Floyd-Steinberg Dithering Algorithm” quantization error introduced at each pixel is spread over the neighboring pixels as follows:

Quantization error observed at pixel (i, j) is diffused to the right, lower left, below and lower right pixels with the following weights (7/ 16 , 3 / 16 , 5 / 16 , 1 /16). Here, note that the weights sum up to 1. Pseudo-code for the algorithm:

for i = 1 to height for j = 1 to width I2(i,j) = Q(I(i,j)); error = I(x,y) − I2(x,y); I(i,j+1) += 7error/16; I(i+1,j−1) += 3error/16; I(i+1,j) += 5*error/16; I(i+1,j+1) += error/16;

end for end for

Here Q(.) represents inform quantization operator. In this homework, assuming that I(i, j) is uniformly distributed over [0, 1], Q(I(i, j)) can be defined as follows:

Q(I(i, j)) =

1 I(i, j) ≥ 0. 5 0 else

Things to turn in:

(a) M-file (b) Output of uniform quantization (c) Output of “Floyd-Steinberg Dithering Algorithm” (d) Comments on the differences between results.