Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Teaching aDiscrete Wavelets Transform Course
Helmut KnaustDepartment of Mathematical Sciences
The University of Texas at El PasoEl Paso TX 79968-0514
Scottsdale AZ April 9, 2010
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
1 Course Setup
2 The Problem
3 Basics of Digital Signal Processing
4 Approximating Data
5 JPEG 2000 Algorithm
6 Learning Mathematica - Scaffolding during the Semester
7 Final Projects - Spring 2009
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Objectives:
Students will make considerable progress in the followingareas:
1 Develop an understanding of the theoretical underpinningsof wavelet transforms and their applications.
2 Learn how to use a computer algebra system formathematical investigations, as a computational andvisualization aid, and for the implementation ofmathematical algorithms.
3 Get a flavor of the ideas and issues involved in applyingmathematics to a relevant engineering problem.
4 Be able to give and defend a mathematical presentation toa group of your peers.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Objectives:
Students will make considerable progress in the followingareas:
1 Develop an understanding of the theoretical underpinningsof wavelet transforms and their applications.
2 Learn how to use a computer algebra system formathematical investigations, as a computational andvisualization aid, and for the implementation ofmathematical algorithms.
3 Get a flavor of the ideas and issues involved in applyingmathematics to a relevant engineering problem.
4 Be able to give and defend a mathematical presentation toa group of your peers.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Objectives:
Students will make considerable progress in the followingareas:
1 Develop an understanding of the theoretical underpinningsof wavelet transforms and their applications.
2 Learn how to use a computer algebra system formathematical investigations, as a computational andvisualization aid, and for the implementation ofmathematical algorithms.
3 Get a flavor of the ideas and issues involved in applyingmathematics to a relevant engineering problem.
4 Be able to give and defend a mathematical presentation toa group of your peers.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Objectives:
Students will make considerable progress in the followingareas:
1 Develop an understanding of the theoretical underpinningsof wavelet transforms and their applications.
2 Learn how to use a computer algebra system formathematical investigations, as a computational andvisualization aid, and for the implementation ofmathematical algorithms.
3 Get a flavor of the ideas and issues involved in applyingmathematics to a relevant engineering problem.
4 Be able to give and defend a mathematical presentation toa group of your peers.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Objectives:
Students will make considerable progress in the followingareas:
1 Develop an understanding of the theoretical underpinningsof wavelet transforms and their applications.
2 Learn how to use a computer algebra system formathematical investigations, as a computational andvisualization aid, and for the implementation ofmathematical algorithms.
3 Get a flavor of the ideas and issues involved in applyingmathematics to a relevant engineering problem.
4 Be able to give and defend a mathematical presentation toa group of your peers.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Prerequisites:A thorough understanding of CalculusSome familiarity with matricesMathematical maturityWillingness to learn Mathematica
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)Four individual student projects and a final group projectTwo midterm exams, no final examHomework assigned regularly; students present solutionsin class.Classroom with LCD projector; computer laboratory is nextdoor.Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)
Four individual student projects and a final group projectTwo midterm exams, no final examHomework assigned regularly; students present solutionsin class.Classroom with LCD projector; computer laboratory is nextdoor.Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)Four individual student projects and a final group project
Two midterm exams, no final examHomework assigned regularly; students present solutionsin class.Classroom with LCD projector; computer laboratory is nextdoor.Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)Four individual student projects and a final group projectTwo midterm exams, no final exam
Homework assigned regularly; students present solutionsin class.Classroom with LCD projector; computer laboratory is nextdoor.Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)Four individual student projects and a final group projectTwo midterm exams, no final examHomework assigned regularly; students present solutionsin class.
Classroom with LCD projector; computer laboratory is nextdoor.Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)Four individual student projects and a final group projectTwo midterm exams, no final examHomework assigned regularly; students present solutionsin class.Classroom with LCD projector; computer laboratory is nextdoor.
Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Course Structure:
Three semester credit hours (2 × 80 minutes per week)Four individual student projects and a final group projectTwo midterm exams, no final examHomework assigned regularly; students present solutionsin class.Classroom with LCD projector; computer laboratory is nextdoor.Night class at 6:30 p.m.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Time Spent:
40% Lecturing at the whiteboard40% Lecturing using Mathematica notebooks20% Students working on projects
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Patrick van FleetDiscrete WaveletTransformations: AnElementary Approach withApplicationsWiley
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
An Alternative:
Arne Jensen and Anders LaCour-Harbo:Ripples in Mathematics: TheDiscrete Wavelet TransformSpringer
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
The Engineering Problem:Transmit digital information through a “narrow channel”.“Lossy compression”: The information received need notbe identical to the one sent, but the quality must be“acceptable”.
Sender
Channel
Receiver
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Applications:PhotosMP3 playersReal-time two-way audio (cellular telephones)
Streaming video (Netflix, Hulu)Real-time two-way audio and video (Skype)
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Applications:PhotosMP3 playersReal-time two-way audio (cellular telephones)Streaming video (Netflix, Hulu)
Real-time two-way audio and video (Skype)
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Applications:PhotosMP3 playersReal-time two-way audio (cellular telephones)Streaming video (Netflix, Hulu)Real-time two-way audio and video (Skype)
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
A color image consists of three color channels: Red, Green andBlue
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Each pixel in a gray-scale image is represented by an integerbetween 0 and 255 = 28 − 1 (8 bit = 1 byte)
0=black, 255=white
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
“Raw” storage requirement:(512 × 768) bytes = 393.2 KB
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
“Naive compression” — Average of four neighboring pixels:Compression factor: 4
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Mathematical Question: What ways are there to approximate afunction (“data”) other than just averaging?
Differentiation Techniques
Taylor series
Integration Techniques
Fourier seriesWavelets
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Mathematical Question: What ways are there to approximate afunction (“data”) other than just averaging?
Differentiation Techniques
Taylor seriesIntegration Techniques
Fourier seriesWavelets
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Mathematical Question: What ways are there to approximate afunction (“data”) other than just averaging?
Differentiation TechniquesTaylor series
Integration Techniques
Fourier seriesWavelets
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Mathematical Question: What ways are there to approximate afunction (“data”) other than just averaging?
Differentiation TechniquesTaylor series
Integration Techniques
Fourier seriesWavelets
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Mathematical Question: What ways are there to approximate afunction (“data”) other than just averaging?
Differentiation TechniquesTaylor series
Integration TechniquesFourier seriesWavelets
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Fourier approximation
-Π -3 Π
4-
Π
2-
Π
4
Π
4
Π
2
3 Π
4Π
-2.0
-1.5
-1.0
-0.5
6
0.827958 sin(t)− 0.310564 sin(2t) + 0.191515 sin(3t)−0.139372 sin(4t) + 0.109891 sin(5t)− 0.0908419 sin(6t) +0.586021 cos(t)− 0.172359 cos(2t) + 0.079192 cos(3t)−0.0450785 cos(4t) + 0.0290109 cos(5t)− 0.0202076 cos(6t)−0.465052
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
The first Fourier functions:
-3 -2 -1 1 2 3
0.5
1.0
1.5
2.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
-3 -2 -1 1 2 3
-1.0
-0.5
0.5
1.0
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
The JPEG algorithm uses Fourier techniques - it employs the“Discrete Cosine Fourier Transform (DCT)”.
Here is a JPEG example with compression factor 6:
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Wavelet pioneers: AlfredHaar (t-r, on the left),
Stephane Mallat (b-r), IngridDaubechies (t)
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
The first Haar functions:
1
-1
1
1
-1
1
1
-1
1
1
-1
1
1
-1
1
1
-1
1
1
-1
1
1
-1
1
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Original image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
1st color channel: Y
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
2nd color channel: Cr
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
3rd color channel: Cb
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Applying the CDF97-wavelet transform to Y once
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
. . . and again. . .
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
. . . and one more time:
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Quantizing the Y channel
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
The sender then encodes this “quantized image” andsends it through the narrow channel to the receiver.
The compression factor in this example is 10.2.
The receiver then decompresses the image to be able toview the approximation of the original image.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
“Undoing” the transform (by receiver)
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Original image, again. . .
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Zooming in on the original image:
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Zooming in on the received image:
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project 01
Due Tuesday, February 3, 2009
� Problem 1
Let B =
1 2 34 5 67 8 10
. Find matrices A and C such that
A.B.C =
7 8 104 5 61 2 3
. Can you choose A or C to be the identity matrix?
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Due February 17, 2009
� Problem 2
Pick a small grayscale image (your choice) and use matrix transposition and multiplication with suitable matrices to
produce the following six images :
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project 04
Due April 9, 2009
� Problem 1 (15 points)
Write a module ' InverseHaarWLTransform[pic_, n_]' to apply the inverse Haar Transform 'n' times to the matrix ' pic'.
Check (using PSNR) that if you apply the Haar transform three times and then your module (with n=3), you obtain the
original image back (modulo loss due to round-off error).
� Problem 2 (15 points)
Write a procedure (preferably a module) to graph a function and its approximation in the vector spaceV4 defined in the handout "Multi-resolution Analysis".
Here is the definition of the father wavelet and the plot of one of the basis elements in V4 :
phiAx_E = Piecewise@881, 0 < x < 1<<, 0D
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
0.2 0.4 0.6 0.8 1.0
0.8
1.0
1.2
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Final Projects - Setup:
Three student groups with three studentsEach group prepares a 20-minute oral presentation using aMathematica notebook.Project topics:
1 Matrix Completion
2 Huffman Tree and Coding3 Zooming in on an Image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Final Projects - Setup:
Three student groups with three students
Each group prepares a 20-minute oral presentation using aMathematica notebook.Project topics:
1 Matrix Completion
2 Huffman Tree and Coding3 Zooming in on an Image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Final Projects - Setup:
Three student groups with three studentsEach group prepares a 20-minute oral presentation using aMathematica notebook.
Project topics:1 Matrix Completion
2 Huffman Tree and Coding3 Zooming in on an Image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Final Projects - Setup:
Three student groups with three studentsEach group prepares a 20-minute oral presentation using aMathematica notebook.Project topics:
1 Matrix Completion
2 Huffman Tree and Coding3 Zooming in on an Image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Final Projects - Setup:
Three student groups with three studentsEach group prepares a 20-minute oral presentation using aMathematica notebook.Project topics:
1 Matrix Completion2 Huffman Tree and Coding
3 Zooming in on an Image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Final Projects - Setup:
Three student groups with three studentsEach group prepares a 20-minute oral presentation using aMathematica notebook.Project topics:
1 Matrix Completion2 Huffman Tree and Coding3 Zooming in on an Image
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project A: Matrix Completion∗
Objective: Replace the standard D4-filter by a modified filterthat avoids coefficient wrapping of the last row/column.
Here is the shape of the modified D4-filter:
W8 =
a2 a1 a0 0 0 0 0 00 h3 h2 h1 h0 0 0 00 0 0 h3 h2 h1 h0 00 0 0 0 0 b2 b1 b0
c2 c1 c0 0 0 0 0 00 −h0 h1 −h2 h3 0 0 00 0 0 −h0 h1 −h2 h3 00 0 0 0 0 d2 d1 d0
∗Based on Problem 7.19 of the textbook
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project A: Matrix Completion∗
Objective: Replace the standard D4-filter by a modified filterthat avoids coefficient wrapping of the last row/column.Here is the shape of the modified D4-filter:
W8 =
a2 a1 a0 0 0 0 0 00 h3 h2 h1 h0 0 0 00 0 0 h3 h2 h1 h0 00 0 0 0 0 b2 b1 b0
c2 c1 c0 0 0 0 0 00 −h0 h1 −h2 h3 0 0 00 0 0 −h0 h1 −h2 h3 00 0 0 0 0 d2 d1 d0
∗Based on Problem 7.19 of the textbook
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Matrix Completion
Original D4
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Matrix Completion
Modified D4
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project B: Huffman Tree and Coding
Objective: Write Mathematica commandsto Huffman encode,to Huffman decode, andto produce a Huffman tree.
In[6]:= CodeWord@"Mississippi", 88i, "0"<, 8M, "100"<, 8p, "101"<, 8s, "11"<<DThe coded bit stream for Mississippi is 100011110111101011010 .
In[10]:= Uncodestring@"100011110111101011010",88i, "0"<, 8M, "100"<, 8p, "101"<, 8s, "11"<<D
The word for the bit stream 100011110111101011010 is Mississippi.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project B: Huffman Tree and Coding
Objective: Write Mathematica commandsto Huffman encode,to Huffman decode, andto produce a Huffman tree.
In[6]:= CodeWord@"Mississippi", 88i, "0"<, 8M, "100"<, 8p, "101"<, 8s, "11"<<DThe coded bit stream for Mississippi is 100011110111101011010 .
In[10]:= Uncodestring@"100011110111101011010",88i, "0"<, 8M, "100"<, 8p, "101"<, 8s, "11"<<D
The word for the bit stream 100011110111101011010 is Mississippi.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project B: Huffman Tree and Coding
Objective: Write Mathematica commandsto Huffman encode,to Huffman decode, andto produce a Huffman tree.
In[6]:= CodeWord@"Mississippi", 88i, "0"<, 8M, "100"<, 8p, "101"<, 8s, "11"<<DThe coded bit stream for Mississippi is 100011110111101011010 .
In[10]:= Uncodestring@"100011110111101011010",88i, "0"<, 8M, "100"<, 8p, "101"<, 8s, "11"<<D
The word for the bit stream 100011110111101011010 is Mississippi.
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Huffman Tree and Coding
In[59]:= HuffTree@"Supercalifragilisticexpialidocious"D
0 1
0 1 0 1
0 1 0 10 1
0 1 0 10 1 0 1 0 1 0 1
0 1 0 1 0 1
i
a cu le p s ro
f S t gd x
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Project C: Zooming In
bB
vV
hH
dD
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects
Any Questions?
Contact: [email protected]
Setup The Problem Basic DSP Approximating Data JPEG2000 Learning Mathematica Final Projects