12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

638 appendix e[D&J 94], DWT files containing long strings of zeros result. Through a type of compressionknown as entropy coding, the amount of memory needed to store files ofthis sort can be greatly reduced.Before we go on to compression algorithms, it is important to note that there aredifferent types of thresholding. In hard thresholding, a rather arbitrary tolerance isselected, and any wavelet coefficient whose absolute value is below this toleranceis set to zero. Presumably, these small numbers have only small effects on theimage. In soft thresholding, a tolerance h is selected, and, as before, any waveletcoefficient whose absolute value is below this tolerance is set to zero. However, allother entries d are replaced with sign(d) ||d|−h|. Soft thresholding can be thoughtof as a translation of the signal toward zero by the amount h. Finally, in quantilethresholding, a percentage p of entries are selected, and p percent of those entrieswith the smallest absolute values are set to zero.DWT with thresholding is useful in analyzing signals and for compressing signalsso that less memory is needed to store the transforms than to store the originalsignals. However, we have yet to take advantage of the frequent occurrence of zerosas wavelet coefficients. Huffman entropy coding is well suited for compressing datathat contain many zeros. With this method, an integer sequence q is changed to ashorter sequence e that is stored as 8-bit integers. Strings of zeros are coded by thenumbers 1–100, 105, and 106, while nonzero integers in q are coded by 101–104 and107–254. The idea is to use two or three numbers for coding, with the first beinga signal that a large number or a long zero sequence is coming. Entropy coding isdesigned so that the numbers that are expected to appear the most often in q needthe least amount of space in e.A step in compression, known as quantization, converts a sequence w of floatingpointnumbers to a sequence q of integers. The simplest technique is to round thefloats to the nearest integer. Another option is to multiply each number in w bya constant k and then round to the nearest integer. Quantization is called lossybecause information is lost when a float is converted to an integer. In Table G.1 weshowed the effect of compression using the WinZip data compression algorithm.This is a hybrid of LZ77 and Huffman coding also known as Deflate.G.2 Wavelet Implementation and Assessment1. Write a program to plot Daub4 wavelets. (Our sample program is Daub4.java.)Observe the behavior of the wavelet functions for different values of thecoefficients. In order to do this, place a1inthecoefficient vector for thewavelet structure you want and place 0’s in all other locations. Then performthe inverse transform to produce the physical domain representation of thewavelet.2. Run the code Daub4.java for different threshold values.3. Run the code DaubCompress.java that uses other functions to give input data.4. Write a Java program or applet that compresses a 512 × 512 image using Daub4wavelets. To do this, extend method wt1 so that it performs a 2-D wavelettransform. Note that you may need some methods from the java.awt.image−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 638

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!