Problem #1


I used the gray level image 'cameraman.tif', which is included in the Matlab image processing toolbox. This seems to be a popular image, since a similar image appears in the chapter on compression we were given in class.

Part a.
Binary quantization by thresholding at the average pixel value.
Origianl gray image Thresholded binary image
Source Code: hw1_a.m

Part b.
Binary quantization using the Floyd-Steinberg error diffusion algorithm as described at http://www.ece.purdue.edu/~bouman/grad-labs/lab7/pdf/lab.pdf. Note the "worm" patterns that appear in the binary image.
Origianl gray image Floyd-Steinberg binary image
Source Code: hw1_b.m


Note: Rather than mapping to 0&1, I mapped the images to 0&255. This allows us to feed the output directly into MATLAB's imshow command. If a strict 0-1 mapping is desired, we could do this as a post-processing step for each pixel:
if A(i,j) == 255 then A(i,j) = 1.
Back to HW 1 page.