81
The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transform

The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Structure of Digital Imaging: The HaarWavelet Transformation and Image Compression

Adam L. Bruce and Alice R. Pitt

December 7, 2009

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 2: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 3: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Abstract

The Haar wavelet transform allows images to be compressedand sent over a network of computers so that it is visable toanyone on the network. The mathematical apparatus for thetransform is that of linear algebra and other elements of matrixtheory, the main part of this being manipulations applied tothe initial matrix representing a certian resolution of an image.It shall be shown how these techniques are used in conjuctionwith each other to create a given digital image of a certainresolution.Prerequisites: A rudimentary knowledge of matrices andarithmetical operations. Also, an indtroductory course in linearalgebra would be helpful for the third section.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 4: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Overview

I How is an image sent over a computer network?

I It’s possible through a technique called the Haar wavelettransformation.

I There are two main mathematical processes averaging anddifferencing.

I They are simple, but to use them in a large matrix requiressome linear algebra.

I Most of the operations can also be programmed into Matlab.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 5: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Overview

I How is an image sent over a computer network?

I It’s possible through a technique called the Haar wavelettransformation.

I There are two main mathematical processes averaging anddifferencing.

I They are simple, but to use them in a large matrix requiressome linear algebra.

I Most of the operations can also be programmed into Matlab.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 6: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Overview

I How is an image sent over a computer network?

I It’s possible through a technique called the Haar wavelettransformation.

I There are two main mathematical processes averaging anddifferencing.

I They are simple, but to use them in a large matrix requiressome linear algebra.

I Most of the operations can also be programmed into Matlab.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 7: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Overview

I How is an image sent over a computer network?

I It’s possible through a technique called the Haar wavelettransformation.

I There are two main mathematical processes averaging anddifferencing.

I They are simple, but to use them in a large matrix requiressome linear algebra.

I Most of the operations can also be programmed into Matlab.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 8: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Overview

I How is an image sent over a computer network?

I It’s possible through a technique called the Haar wavelettransformation.

I There are two main mathematical processes averaging anddifferencing.

I They are simple, but to use them in a large matrix requiressome linear algebra.

I Most of the operations can also be programmed into Matlab.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 9: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I Every Image represents a matrix

I The numbers within the matrix represent different shades ofblack and white or color.

I The values of the numbers range from 0 to some positivewhole number.

I For this presentation we will only consider gray-scale images.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 10: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I Every Image represents a matrix

I The numbers within the matrix represent different shades ofblack and white or color.

I The values of the numbers range from 0 to some positivewhole number.

I For this presentation we will only consider gray-scale images.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 11: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I Every Image represents a matrix

I The numbers within the matrix represent different shades ofblack and white or color.

I The values of the numbers range from 0 to some positivewhole number.

I For this presentation we will only consider gray-scale images.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 12: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I Every Image represents a matrix

I The numbers within the matrix represent different shades ofblack and white or color.

I The values of the numbers range from 0 to some positivewhole number.

I For this presentation we will only consider gray-scale images.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 13: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I So consider the matrix:

A =

123 145 222 234 68 66 76 1234 19 187 188 47 182 209 4

144 55 23 27 111 29 250 048 38 79 247 72 77 112 1463 14 149 150 37 44 121 11

233 155 122 69 58 47 136 1834 21 13 59 209 146 100 10

211 151 98 60 32 31 88 17

I This could represent some portion of an image

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 14: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I So consider the matrix:

A =

123 145 222 234 68 66 76 1234 19 187 188 47 182 209 4

144 55 23 27 111 29 250 048 38 79 247 72 77 112 1463 14 149 150 37 44 121 11

233 155 122 69 58 47 136 1834 21 13 59 209 146 100 10

211 151 98 60 32 31 88 17

I This could represent some portion of an image

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 15: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

An Image as a Matrix

I The image

Figure: Bird

is a 256 by 256 matrix.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 16: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I So how do we transport the image?

I Using averaging and differencing we can actually compress animage, making it easier to transport.

I How is this done?

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 17: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I So how do we transport the image?

I Using averaging and differencing we can actually compress animage, making it easier to transport.

I How is this done?

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 18: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I So how do we transport the image?

I Using averaging and differencing we can actually compress animage, making it easier to transport.

I How is this done?

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 19: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I To average first we isolate a row, called a data string, such as

S1 =(122 145 222 234 68 66 76 12

)This is row one of Matrix A.

I We now can find the basic average of these terms, given by

y =x1 + x2

2.

where x1 and x2 are two elements in S1 which are next toeach other.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 20: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I To average first we isolate a row, called a data string, such as

S1 =(122 145 222 234 68 66 76 12

)This is row one of Matrix A.

I We now can find the basic average of these terms, given by

y =x1 + x2

2.

where x1 and x2 are two elements in S1 which are next toeach other.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 21: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I The difference is found by taking the average and subtractingthem from x1 like

d = x1 − y

I These differenced numbers are the detail coefficients.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 22: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I The difference is found by taking the average and subtractingthem from x1 like

d = x1 − y

I These differenced numbers are the detail coefficients.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 23: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I Both averaging and differencing must take place 3 times witha string with length 8.

I This is because 23 = 8.

I Here is a table which summarizes the results on S1:

Table: Averaging and Differencing of S1

Compression No. average/detail coefficient

1 133.5 228 67 44 -11.5 -6 1 322 180.7 55.5 -47.2 12 -11.5 -6 1 323 118 67.7 -47.2 12 -11.5 -6 1 32

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 24: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I Both averaging and differencing must take place 3 times witha string with length 8.

I This is because 23 = 8.

I Here is a table which summarizes the results on S1:

Table: Averaging and Differencing of S1

Compression No. average/detail coefficient

1 133.5 228 67 44 -11.5 -6 1 322 180.7 55.5 -47.2 12 -11.5 -6 1 323 118 67.7 -47.2 12 -11.5 -6 1 32

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 25: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Averaging and Differencing

I Both averaging and differencing must take place 3 times witha string with length 8.

I This is because 23 = 8.

I Here is a table which summarizes the results on S1:

Table: Averaging and Differencing of S1

Compression No. average/detail coefficient

1 133.5 228 67 44 -11.5 -6 1 322 180.7 55.5 -47.2 12 -11.5 -6 1 323 118 67.7 -47.2 12 -11.5 -6 1 32

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 26: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Basic Compression Matrices

I Consider images as matrices. There must be an efficient wayto apply the previous idea of averaging and differencing to amatrix the size of 256 by 256.

I This would bring in a compression matrix:

1/2 0 0 0 1/2 0 0 01/2 0 0 0 −1/2 0 0 0

0 1/2 0 0 0 1/2 0 00 1/2 0 0 0 −1/2 0 00 0 1/2 0 0 0 1/2 00 0 1/2 0 0 0 −1/2 00 0 0 1/2 0 0 0 1/20 0 0 1/2 0 0 0 −1/2

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 27: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Basic Compression Matrices

I Consider images as matrices. There must be an efficient wayto apply the previous idea of averaging and differencing to amatrix the size of 256 by 256.

I This would bring in a compression matrix:

1/2 0 0 0 1/2 0 0 01/2 0 0 0 −1/2 0 0 0

0 1/2 0 0 0 1/2 0 00 1/2 0 0 0 −1/2 0 00 0 1/2 0 0 0 1/2 00 0 1/2 0 0 0 −1/2 00 0 0 1/2 0 0 0 1/20 0 0 1/2 0 0 0 −1/2

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 28: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

I This simplifies what could be a rather long process otherwise.

I Here is our compression matrix multiplied with our initialmatrix three times to create matrix T:

T =

118.1 3.9 −17.8 −9.1 62.6 −12.6 −29.4 6.4108.8 10.5 −38.3 −40.5 −1.8 −7.0 −42.3 44.579.9 52.1 4.9 −9.4 −17.6 −30.9 32.4 32.685.9 −8.1 −27.1 9.4 17.1 −31.4 −32.9 35.173.6 18.9 −34.1 −8.4 20.1 −6.9 −21.4 20.9

104.6 32.5 18.5 −10.3 40.0 0.3 30.8 16.574.0 15.0 28.5 4.0 −42.3 −23.3 −32.8 10.886.0 21.3 20.3 −6.0 44.0 3.3 30.8 11.5

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 29: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

I This simplifies what could be a rather long process otherwise.

I Here is our compression matrix multiplied with our initialmatrix three times to create matrix T:

T =

118.1 3.9 −17.8 −9.1 62.6 −12.6 −29.4 6.4108.8 10.5 −38.3 −40.5 −1.8 −7.0 −42.3 44.579.9 52.1 4.9 −9.4 −17.6 −30.9 32.4 32.685.9 −8.1 −27.1 9.4 17.1 −31.4 −32.9 35.173.6 18.9 −34.1 −8.4 20.1 −6.9 −21.4 20.9

104.6 32.5 18.5 −10.3 40.0 0.3 30.8 16.574.0 15.0 28.5 4.0 −42.3 −23.3 −32.8 10.886.0 21.3 20.3 −6.0 44.0 3.3 30.8 11.5

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 30: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Compression

I The process of applying the compression matrix to the initialmatrix multiple times is wavelet transform.

I This process is meant to transform data in the matrix to zeroor near zero.

I A matrix is considered sparse when it is highly composed ofzeros.

I Compression involves choosing a threshold value e, let’s sete = 20.

I Then all numbers that fall within the absolute value of e willbe made into a zero.

I This helps to maitain the images beginning integrity whilesaving space or transmission time.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 31: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Compression

I The process of applying the compression matrix to the initialmatrix multiple times is wavelet transform.

I This process is meant to transform data in the matrix to zeroor near zero.

I A matrix is considered sparse when it is highly composed ofzeros.

I Compression involves choosing a threshold value e, let’s sete = 20.

I Then all numbers that fall within the absolute value of e willbe made into a zero.

I This helps to maitain the images beginning integrity whilesaving space or transmission time.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 32: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Compression

I The process of applying the compression matrix to the initialmatrix multiple times is wavelet transform.

I This process is meant to transform data in the matrix to zeroor near zero.

I A matrix is considered sparse when it is highly composed ofzeros.

I Compression involves choosing a threshold value e, let’s sete = 20.

I Then all numbers that fall within the absolute value of e willbe made into a zero.

I This helps to maitain the images beginning integrity whilesaving space or transmission time.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 33: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Compression

I The process of applying the compression matrix to the initialmatrix multiple times is wavelet transform.

I This process is meant to transform data in the matrix to zeroor near zero.

I A matrix is considered sparse when it is highly composed ofzeros.

I Compression involves choosing a threshold value e, let’s sete = 20.

I Then all numbers that fall within the absolute value of e willbe made into a zero.

I This helps to maitain the images beginning integrity whilesaving space or transmission time.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 34: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Compression

I The process of applying the compression matrix to the initialmatrix multiple times is wavelet transform.

I This process is meant to transform data in the matrix to zeroor near zero.

I A matrix is considered sparse when it is highly composed ofzeros.

I Compression involves choosing a threshold value e, let’s sete = 20.

I Then all numbers that fall within the absolute value of e willbe made into a zero.

I This helps to maitain the images beginning integrity whilesaving space or transmission time.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 35: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Compression

I The process of applying the compression matrix to the initialmatrix multiple times is wavelet transform.

I This process is meant to transform data in the matrix to zeroor near zero.

I A matrix is considered sparse when it is highly composed ofzeros.

I Compression involves choosing a threshold value e, let’s sete = 20.

I Then all numbers that fall within the absolute value of e willbe made into a zero.

I This helps to maitain the images beginning integrity whilesaving space or transmission time.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 36: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

I This is our matrix T after the threshold value e = 20 has beenapplied. We’ll call it matrix D:

D =

118.1 0 0 0 62.6 0 −29.4 0108.8 0 −38.3 −40.5 0 0 −42.3 44.579.9 52.1 0 0 0 −30.9 32.4 32.685.9 0 −27.1 0 0 −31.4 −32.9 35.173.6 0 −34.1 0 20.1 0 −21.4 20.9

104.6 32.5 0 0 40.0 0 30.8 074.0 0 28.5 0 −42.3 −23.3 −32.8 086.0 21.3 20.3 0 44.0 0 30.8 0

I This has created 27 zero components in our matrix creating a2:1 compression ratio.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 37: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

I This is our matrix T after the threshold value e = 20 has beenapplied. We’ll call it matrix D:

D =

118.1 0 0 0 62.6 0 −29.4 0108.8 0 −38.3 −40.5 0 0 −42.3 44.579.9 52.1 0 0 0 −30.9 32.4 32.685.9 0 −27.1 0 0 −31.4 −32.9 35.173.6 0 −34.1 0 20.1 0 −21.4 20.9

104.6 32.5 0 0 40.0 0 30.8 074.0 0 28.5 0 −42.3 −23.3 −32.8 086.0 21.3 20.3 0 44.0 0 30.8 0

I This has created 27 zero components in our matrix creating a

2:1 compression ratio.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 38: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Progressive Image Transmission

I Progressive Image transmission utilizes the previoustechniques.

I The compression process allows the first image we attain tobe comparable to our matrix T .

I Matrix T is brought up starting with the overall average,largerdetail coefficients and finally the smallest detail coefficients.

I T matrix initial image is crude but as more waveletcoefficients are used the image slowly becomes an exact copyof the initial image.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 39: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Progressive Image Transmission

I Progressive Image transmission utilizes the previoustechniques.

I The compression process allows the first image we attain tobe comparable to our matrix T .

I Matrix T is brought up starting with the overall average,largerdetail coefficients and finally the smallest detail coefficients.

I T matrix initial image is crude but as more waveletcoefficients are used the image slowly becomes an exact copyof the initial image.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 40: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Progressive Image Transmission

I Progressive Image transmission utilizes the previoustechniques.

I The compression process allows the first image we attain tobe comparable to our matrix T .

I Matrix T is brought up starting with the overall average,largerdetail coefficients and finally the smallest detail coefficients.

I T matrix initial image is crude but as more waveletcoefficients are used the image slowly becomes an exact copyof the initial image.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 41: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Progressive Image Transmission

I Progressive Image transmission utilizes the previoustechniques.

I The compression process allows the first image we attain tobe comparable to our matrix T .

I Matrix T is brought up starting with the overall average,largerdetail coefficients and finally the smallest detail coefficients.

I T matrix initial image is crude but as more waveletcoefficients are used the image slowly becomes an exact copyof the initial image.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 42: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Figure: The progressive transmission of figure 1 (3rd compression to 1stcompression)

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 43: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Creating compressions of large matrices, such as 256 by 256 isdifficult and time consuming by hand

I Therefore we program the compression matrices with Matlab

I This is by defining the matrix as a function and writting codefor a matrix with variable dimentions

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 44: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Creating compressions of large matrices, such as 256 by 256 isdifficult and time consuming by hand

I Therefore we program the compression matrices with Matlab

I This is by defining the matrix as a function and writting codefor a matrix with variable dimentions

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 45: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Creating compressions of large matrices, such as 256 by 256 isdifficult and time consuming by hand

I Therefore we program the compression matrices with Matlab

I This is by defining the matrix as a function and writting codefor a matrix with variable dimentions

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 46: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Frist we define our function and variable. Using the name’indmat’

I we code this likefunction a = indmat(n)b=[1;1]/2c=[1;-1]/2

I This creates two vectors, b, and c which consists of < 12 , 1

2 >and < 1

2 ,−12 > respectively.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 47: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Frist we define our function and variable. Using the name’indmat’

I we code this likefunction a = indmat(n)b=[1;1]/2c=[1;-1]/2

I This creates two vectors, b, and c which consists of < 12 , 1

2 >and < 1

2 ,−12 > respectively.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 48: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Frist we define our function and variable. Using the name’indmat’

I we code this likefunction a = indmat(n)b=[1;1]/2c=[1;-1]/2

I This creates two vectors, b, and c which consists of < 12 , 1

2 >and < 1

2 ,−12 > respectively.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 49: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I next we specify the first half of the matrix which will averagethe image.

I this iswhile min(size(b))< n/2b=[b, zeros(max(size(b)),min(size(b)));...zeros(max(size(b)),min(size(b))), b];end

I Then, to specify the differencing half, we use the same code,replacing ’c’s for the ’b’s.

I We finally create a larger matrix out of the two of these witha=[b,c]

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 50: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I next we specify the first half of the matrix which will averagethe image.

I this iswhile min(size(b))< n/2b=[b, zeros(max(size(b)),min(size(b)));...zeros(max(size(b)),min(size(b))), b];end

I Then, to specify the differencing half, we use the same code,replacing ’c’s for the ’b’s.

I We finally create a larger matrix out of the two of these witha=[b,c]

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 51: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I next we specify the first half of the matrix which will averagethe image.

I this iswhile min(size(b))< n/2b=[b, zeros(max(size(b)),min(size(b)));...zeros(max(size(b)),min(size(b))), b];end

I Then, to specify the differencing half, we use the same code,replacing ’c’s for the ’b’s.

I We finally create a larger matrix out of the two of these witha=[b,c]

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 52: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I next we specify the first half of the matrix which will averagethe image.

I this iswhile min(size(b))< n/2b=[b, zeros(max(size(b)),min(size(b)));...zeros(max(size(b)),min(size(b))), b];end

I Then, to specify the differencing half, we use the same code,replacing ’c’s for the ’b’s.

I We finally create a larger matrix out of the two of these witha=[b,c]

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 53: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Now that we have the compression matrix we apply’indmat(256)’ to our original image. This creates the 1stcompression

I To compress again we apply the matrix2ndcompression=[indmat(128),zeroes(128);zeroes(128),eye(128)]

I For the next compression the dimention is reduced by 2 again,but there must be more blocks.3rdcompression=[indmat(64),zeroes(64),zeroes(64),zeroes(64);zeroes(64),eye(64),zeroes(64),zeroes(64);zeroes(64), ze-roes(64),eye(64),zeroes(64);zeroes(64),zeroes(64),zeroes(64),eye(64)]

I Thus, eventually the image becomes compressed to asignificant enough degree to be sent

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 54: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Now that we have the compression matrix we apply’indmat(256)’ to our original image. This creates the 1stcompression

I To compress again we apply the matrix2ndcompression=[indmat(128),zeroes(128);zeroes(128),eye(128)]

I For the next compression the dimention is reduced by 2 again,but there must be more blocks.3rdcompression=[indmat(64),zeroes(64),zeroes(64),zeroes(64);zeroes(64),eye(64),zeroes(64),zeroes(64);zeroes(64), ze-roes(64),eye(64),zeroes(64);zeroes(64),zeroes(64),zeroes(64),eye(64)]

I Thus, eventually the image becomes compressed to asignificant enough degree to be sent

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 55: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Now that we have the compression matrix we apply’indmat(256)’ to our original image. This creates the 1stcompression

I To compress again we apply the matrix2ndcompression=[indmat(128),zeroes(128);zeroes(128),eye(128)]

I For the next compression the dimention is reduced by 2 again,but there must be more blocks.3rdcompression=[indmat(64),zeroes(64),zeroes(64),zeroes(64);zeroes(64),eye(64),zeroes(64),zeroes(64);zeroes(64), ze-roes(64),eye(64),zeroes(64);zeroes(64),zeroes(64),zeroes(64),eye(64)]

I Thus, eventually the image becomes compressed to asignificant enough degree to be sent

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 56: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Programming Compressions with Matlab

I Now that we have the compression matrix we apply’indmat(256)’ to our original image. This creates the 1stcompression

I To compress again we apply the matrix2ndcompression=[indmat(128),zeroes(128);zeroes(128),eye(128)]

I For the next compression the dimention is reduced by 2 again,but there must be more blocks.3rdcompression=[indmat(64),zeroes(64),zeroes(64),zeroes(64);zeroes(64),eye(64),zeroes(64),zeroes(64);zeroes(64), ze-roes(64),eye(64),zeroes(64);zeroes(64),zeroes(64),zeroes(64),eye(64)]

I Thus, eventually the image becomes compressed to asignificant enough degree to be sent

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 57: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can generalize the averaging and differencing constitutingthe compression

I For any string the equation c1 = sA1 represents the firstcompression, where A is the general compression matrix.

I for the second compression, the equation is c2 = c1A2

I the A matrix is the block matrix

A2 =

(A 00 I

)I for the 3rd compression the equation is c3 = c2A3 with the A

matrix being

A3 =

A 0 0 00 I 0 00 0 I 00 0 0 I

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 58: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can generalize the averaging and differencing constitutingthe compression

I For any string the equation c1 = sA1 represents the firstcompression, where A is the general compression matrix.

I for the second compression, the equation is c2 = c1A2

I the A matrix is the block matrix

A2 =

(A 00 I

)I for the 3rd compression the equation is c3 = c2A3 with the A

matrix being

A3 =

A 0 0 00 I 0 00 0 I 00 0 0 I

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 59: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can generalize the averaging and differencing constitutingthe compression

I For any string the equation c1 = sA1 represents the firstcompression, where A is the general compression matrix.

I for the second compression, the equation is c2 = c1A2

I the A matrix is the block matrix

A2 =

(A 00 I

)

I for the 3rd compression the equation is c3 = c2A3 with the Amatrix being

A3 =

A 0 0 00 I 0 00 0 I 00 0 0 I

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 60: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can generalize the averaging and differencing constitutingthe compression

I For any string the equation c1 = sA1 represents the firstcompression, where A is the general compression matrix.

I for the second compression, the equation is c2 = c1A2

I the A matrix is the block matrix

A2 =

(A 00 I

)I for the 3rd compression the equation is c3 = c2A3 with the A

matrix being

A3 =

A 0 0 00 I 0 00 0 I 00 0 0 I

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 61: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I in general the equation for the nth compression will becn = cn−1An

I The matrix An is

cn = cn−1

A 0 0 . . . 00 I 0 . . . 00 0 I . . . 0...

......

. . ....

0 0 0 . . . I2n−1−1

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 62: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I in general the equation for the nth compression will becn = cn−1An

I The matrix An is

cn = cn−1

A 0 0 . . . 00 I 0 . . . 00 0 I . . . 0...

......

. . ....

0 0 0 . . . I2n−1−1

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 63: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can multiply all of the A matrices together to do theentire series of compressions in one step

I We call this W and say that W = A1A2A3 . . . An where n isthe total amount of compressions.

I So the equation c = sW , where c is the complete compressionof the image, will do all of the avereging and differencing inone step.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 64: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can multiply all of the A matrices together to do theentire series of compressions in one step

I We call this W and say that W = A1A2A3 . . . An where n isthe total amount of compressions.

I So the equation c = sW , where c is the complete compressionof the image, will do all of the avereging and differencing inone step.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 65: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I We can multiply all of the A matrices together to do theentire series of compressions in one step

I We call this W and say that W = A1A2A3 . . . An where n isthe total amount of compressions.

I So the equation c = sW , where c is the complete compressionof the image, will do all of the avereging and differencing inone step.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 66: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I The beauty of this process is that it is invertable; oncecompressed, the original image can be reconstructed from thecompression.

I Not suprisingly, the equation s = cW−1 does this.

I This is called the Inverse Haar Wavelet Transform.

I For the general case, the equationW−1 = A−1

n A−1n−1A−1

n−2 . . . A−11 gives the matrix W

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 67: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I The beauty of this process is that it is invertable; oncecompressed, the original image can be reconstructed from thecompression.

I Not suprisingly, the equation s = cW−1 does this.

I This is called the Inverse Haar Wavelet Transform.

I For the general case, the equationW−1 = A−1

n A−1n−1A−1

n−2 . . . A−11 gives the matrix W

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 68: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I The beauty of this process is that it is invertable; oncecompressed, the original image can be reconstructed from thecompression.

I Not suprisingly, the equation s = cW−1 does this.

I This is called the Inverse Haar Wavelet Transform.

I For the general case, the equationW−1 = A−1

n A−1n−1A−1

n−2 . . . A−11 gives the matrix W

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 69: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I The beauty of this process is that it is invertable; oncecompressed, the original image can be reconstructed from thecompression.

I Not suprisingly, the equation s = cW−1 does this.

I This is called the Inverse Haar Wavelet Transform.

I For the general case, the equationW−1 = A−1

n A−1n−1A−1

n−2 . . . A−11 gives the matrix W

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 70: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I For a String of length 2n, W must have a dimension of n byn, and therefore so must the A matrices. Also note that nmatrices are neededto completely compress the image.

I We can derive a product series which aids in the calculation ofW and W−1 for strings of various lengths.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 71: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I For a String of length 2n, W must have a dimension of n byn, and therefore so must the A matrices. Also note that nmatrices are neededto completely compress the image.

I We can derive a product series which aids in the calculation ofW and W−1 for strings of various lengths.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 72: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I This is

W =n∏

i=1

A 0 0 . . . 00 I 0 . . . 00 0 I . . . 0...

......

. . ....

0 0 0 . . . I2i−1−1

and

W−1 =1∏

i=n

A 0 0 . . . 00 I 0 . . . 00 0 I . . . 0...

......

. . ....

0 0 0 . . . I2i−1−1

−1

I The general A matrix represented here is in blocks, thedimension of which are D/2i−1 where D is the originaldimension of the image.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 73: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I This is

W =n∏

i=1

A 0 0 . . . 00 I 0 . . . 00 0 I . . . 0...

......

. . ....

0 0 0 . . . I2i−1−1

and

W−1 =1∏

i=n

A 0 0 . . . 00 I 0 . . . 00 0 I . . . 0...

......

. . ....

0 0 0 . . . I2i−1−1

−1

I The general A matrix represented here is in blocks, thedimension of which are D/2i−1 where D is the originaldimension of the image.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 74: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I Up to this point we have only been averaging the rows of theentire matrix (which we have called strings). Now we will talkabout how to average the columns.

I What we have computed so far is called the row-reduced formof a matrix. The complete compression will be arow-and-column-reduced form.

I the simplest way to do this is by transposing our equations

T = ((PW )T W )T = W T PW

andP = ((T )T W−1)T = (W−1)T TW−1

Where T is the compressed image, and P is the original.

I If we normalized the columns of W we could simplify thiseven more, because the columns would then be orthonormal,making W an orthogonal matrix, thus W−1 = W T .

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 75: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I Up to this point we have only been averaging the rows of theentire matrix (which we have called strings). Now we will talkabout how to average the columns.

I What we have computed so far is called the row-reduced formof a matrix. The complete compression will be arow-and-column-reduced form.

I the simplest way to do this is by transposing our equations

T = ((PW )T W )T = W T PW

andP = ((T )T W−1)T = (W−1)T TW−1

Where T is the compressed image, and P is the original.

I If we normalized the columns of W we could simplify thiseven more, because the columns would then be orthonormal,making W an orthogonal matrix, thus W−1 = W T .

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 76: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I Up to this point we have only been averaging the rows of theentire matrix (which we have called strings). Now we will talkabout how to average the columns.

I What we have computed so far is called the row-reduced formof a matrix. The complete compression will be arow-and-column-reduced form.

I the simplest way to do this is by transposing our equations

T = ((PW )T W )T = W T PW

andP = ((T )T W−1)T = (W−1)T TW−1

Where T is the compressed image, and P is the original.

I If we normalized the columns of W we could simplify thiseven more, because the columns would then be orthonormal,making W an orthogonal matrix, thus W−1 = W T .

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 77: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I Up to this point we have only been averaging the rows of theentire matrix (which we have called strings). Now we will talkabout how to average the columns.

I What we have computed so far is called the row-reduced formof a matrix. The complete compression will be arow-and-column-reduced form.

I the simplest way to do this is by transposing our equations

T = ((PW )T W )T = W T PW

andP = ((T )T W−1)T = (W−1)T TW−1

Where T is the compressed image, and P is the original.

I If we normalized the columns of W we could simplify thiseven more, because the columns would then be orthonormal,making W an orthogonal matrix, thus W−1 = W T .

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 78: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I Then the equation for P would be

P = ((T )T W−1o )T = (W−1

o )T TW−1o = (W T

o )T TW To = WoTW T

o

I This is now much easier to calculate than before, which wouldoptimize the use of a computer’s capacity if it was to beincluded in an algorithm.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 79: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

The Linear Algebra of Image Compression

I Then the equation for P would be

P = ((T )T W−1o )T = (W−1

o )T TW−1o = (W T

o )T TW To = WoTW T

o

I This is now much easier to calculate than before, which wouldoptimize the use of a computer’s capacity if it was to beincluded in an algorithm.

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 80: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Questions

I Any questions?

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression

Page 81: The Structure of Digital Imaging: The Haar Wavelet ... · Wavelet Transformation and Image Compression Adam L. Bruce and Alice R. Pitt December 7, 2009 ... Adam L. Bruce and Alice

Bibliography

Colm Mulcahy. Image Compression Using the Haar WaveletTransform

Adam L. Bruce and Alice R. Pitt The Structure of Digital Imaging: The Haar Wavelet Transformation and Image Compression