Course: CIS451/651 Data Compression
in Multimedia
Professor: Paul D. Amer
Semester: Spring 2011
Title: Homework - Chapter 11 - Differential Encoding
Tasks
Read Chapter 11. Omit Section 11.5.
-
(4 pts) Write a well-documented program or find existing software to count the frequency
of each pixel value in an ".img" image file. Run this program on
sinan.img and
earth.img
- (submit) Using Microsoft Excel (or any other histogram-making
software), produce histograms of the computed frequencies for each image. Your
sinan histogram should look like the histogram in the textbook's Figure 11.2.
- (submit) a copy of your program if you wrote one, else indicate which existing software you used.
- (submit) Indicate the exact number of pixels in each orginal image having the values 0,1,2,3 and 127,128,129 and 252,253,254,255
-
(4 pts) Differential encoding
- Create an "8-bit differential encoding" of sinan.img
(and
earth.img)
named sinan-diff.img
(and earth-diff.img)
using the program you wrote in Project 1.
- (submit) Use the program from the previous question to create a histogram for
the frequency of difference values 0-255 for sinan-diff.img
(and earth-diff.img).
Your sinan histogram should contain the same info as contained in Figure 11.3. The two histograms will appear different since Figure 11.3's x-axis goes from -255 to +255, while your histogram's x-axis goes from 0-255. Remember that a difference of -255 is the same as a difference of +1.
- (submit) Indicate the exact number of pixel differences your historgrams have for differences of 0, 1, and 255
-
(3 pts) (submit) Use Irfanview, xv, GIMP or other software to view and print copies of
sinan.img and sinan-diff.img (and
earth.img and earth-diff.img.)
To view an ".img" image, use Sayood's program "convpgm.c"
to produce a well-known format ".pgm" file, and then view/print the
".pgm" file. Take some time to understand why the difference images look like they do.
Be sure to label your figures.
- (4 pts Extra Credit for all students) Use Sayood's huff_enc program to compute a huffman code for both sinan.img and sinan-diff.img.
Save the two code files separately. huff_enc
generates a fixed length code file of 1280 bytes. The format of the
code file is 256 4-byte "codes" followed by 256 1-byte "lengths". The
first length tells how many least significant bits of the first 4-byte
code are the Huffman code for a pixel value (or pixel difference value
for a difference image) of 0. The second length tells how many least
significant bits of the second 4-byte code are the Huffman code for the
pixel value of 1, and so on. What are the Huffman codes for both sinan.img and sinan-diff.img for the pixel values and pixel
difference values, respectively, of: 126,127,128,129,130 and 253,254,255,0,1,2,3,4,5,6? Looking at the two code files, argue
whether the generated Huffman codes are consistent with the histograms
you produced in parts 1 and 2 above.
Notes
- All source programs must be well documented.
-
Graduate students must do all assignments individually. Undergraduate students may collaborate in groups of
2 for assignments. Only one submission with both names should be turned in from a group.
- Clearly label your answers,
and please submit answers in the order assigned.
- (repeated from course
syllabus) Academic Honesty:
Unless explicitly stated otherwise, students are not permitted to access or compare any homework, or
program-project answers with those of any other student or group past or present, alive or dead, or any Internet
web site prior to submitting the assignment. Comparing answers, or getting answers off the Internet before
submitting one's work is considered cheating. If you do not have time to complete an assignment, it is
better to submit partial solutions than to get answers from someone else. While it is obviously difficult to
enforce this policy, students who do not follow this policy should be keenly aware that in this class, they a
re cheating, and if caught, will be prosecuted according to University guidelines. This applies both to the
student (or group) who gets answers and the student (or group) who gives answers.
- (repeated from course syllabus) Lateness Policy:
Assignments are due at the beginning of class. Unexcused late assignments will be penalized up to 10% per
school day (weekends do not count) up to a 2-day maximum penalty of 20%. Without prior discussion with the
professor, assignments will not be accepted more than two school days late without a university approved
excuse.