12.07.2015 Views

Data Compression: The Complete Reference

Data Compression: The Complete Reference

Data Compression: The Complete Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

492 4. Image <strong>Compression</strong>Figure 4.178: Image for Exercise 4.11.is thus specified by a 4-bit number.Figure 4.180 shows a simple bi-level image and its GFA graph. Quadrant 3 of state0, for example, has to go through transformation 1 in order to make it identical to state1, so there is an edge labeled (3, 1) from state 0 to state 1.⋄ Exercise 4.11: Construct the GFA of the image of Figure 4.178 using transformations,and list all the resulting edges in a table.Images used in practice are more complex and less self-similar than the examplesshown here, so the particular GFA algorithm discussed here (although not GFA ingeneral) allows for a certain amount of data loss in matching subsquares of the image.<strong>The</strong> distance d k (f,g) between two images or subimages f and g of resolution 2 k ×2 k isdefined as∑w=a1a2...ak|f(w) − g(w)|d k (f,g) =2 k ×2 k .<strong>The</strong> numerator of this expression counts the number of pixels that differ in the twoimages, while the denominator is the total number of pixels in each image. <strong>The</strong> distanceis thus the percentage of pixels that differ in the two images (we assume that 0 and 1represent white and black pixels, respectively). <strong>The</strong> four-step algorithm described herefor constructing the graph also uses an error parameter input by the user to control theamount of loss.Step 1: Generate state 0 as the entire image (i.e., subsquare ɛ). We select the initialdistribution as I =(1, 0, 0,...,0), so state 0 will be the only one displayed. <strong>The</strong> finaldistribution is a vector of all ones.Step 2: Process each state as follows: Let the next unprocessed state be q, representingsubsquare w. Partition w into its four quadrants w0, w1, w2, and w3, and perform Step3 for each of the four wa’s.Step 3: Denote the image of subsquare wa by ψ ′ .Ifψ ′ = 0, there is no edge from stateq with label a. Otherwise, examine all the states generated so far and try to find a statep and a transformation t such that t(ψ p ) (the image of state p transformed by t) will besimilar enough to image ψ ′ . This is expressed by d k (ψ ′ ,t(ψ p )) ≤ error. If such p and tare found, construct an edge q(a, t)p. Otherwise, add a new, unprocessed, state r to ψ ′and construct a new edge q(a, 0)r.Step 4: If there are any unprocessed states left, go to Step 2. Otherwise stop.Step 3 may involve many searches, since many states may have to be examinedup to 16 times until a match is found. <strong>The</strong>refore, the algorithm uses two versions forthis search, a first fit and a best fit. Both approaches proceed from state to state,apply each of the 16 transformations to the state, and calculate the distance betweeneach transformed state and ψ ′ . <strong>The</strong> first fit approach stops when it finds the firsttransformed state that fits, while the best fit conducts the full search and selects the

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

Saved successfully!

Ooh no, something went wrong!