Professional Documents
Culture Documents
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Introduction
and examples
I decided to write the program from scratch Reasons: -few softwares exist that give enough flexibility (e.g., matlab toolbox is a black box). -Intent to work on matrices containing millions of elements (matlab inappropriate). -intent to develop a parallel version for operators (density functional theory). -Application of the theory is (actually) relatively simple. -Found a book that gives lengthy details on how to implement the transformations: Discrete Wavelet Transformations, by Patrick J. Van Fleet (Wiley ed., 2008); Problem with the book: Some mistakes in the algorithms (it is the 1st edition). However, algorithms are well described and one can retrieve the correct expressions. What the program does: Iterations of Daubechies Transform (DWT) Daubechies Inverse Transform (IDWT) Plus alterations...
Introduction
and examples
{Horizontal}
{Horizontal}
{Vertical}
{Diagonal}
{EDGE}
{Vertical}
{Diagonal}
Introduction
and examples
DWT
{Blur} = 0
IDWT
Introduction
and examples
DWT {Edge} = 0
IDWT
Introduction
Large scale
Small scale
The brain clearly recognizes a face at both scales
DWT {Edge} = 0
IDWT
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Essential
tools of xv software for image translations and dimensioning Modifying the size of an image
prompt>xv Right clicking on the image pops out the menu. Click Image Size and scroll down to Set Size Click Image Size
For Mac users, xv is part of fink. For very large width/height ratio, one might need to Crop the image.
Essential
tools of xv software for image translations and dimensioning Modifying the size of an image
prompt>xv Right clicking on the image pops out the menu. Click Image Size and scroll down to Set Size
n Choose multiples of 2
Essential
tools of xv software for image translations and dimensioning Saving file in ascii format (integer matrix)
Click Save
Essential
tools of xv software for image translations and dimensioning Saving file in ascii format (integer matrix) Choose Format
Essential
tools of xv software for image translations and dimensioning Saving file in ascii format (integer matrix)
Remark: xv does not read png formats: use convert image.png image.jpg
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Digital
P2 # subject02.wink_16x16.pgm 16 16 255 73 121 183 206 192 180 204 211 213 164 138 124 62 75 37 25 121 146 74 64 76 88 128 157 136 104 108 109 96 93 78 47 137 74 90 122 64 45 74 153 105 41 27 22 44 76 93 85 135 114 39 17 24 33 69 237 151 38 53 118 144 136 111 103 152 133 85 67 64 93 123 245 135 116 95 67 61 83 101 119 151 156 165 175 159 170 133 255 137 138 146 161 199 161 123 114 150 149 183 210 182 143 126 229 139 114 90 213 199 190 156 117 139 131 152 168 164 103 122 206 150 152 130 57 125 140 132 110 132 125 112 129 133 112 138 164 147 71 78 81 53 65 91 111 157 116 112 131 140 125 48 39 31 58 107 89 69 67 95 104 255 121 121 122 96 101 105 52 60 73 64 30 86 111 87 100 255 121 109 100 55 31 37 76 89 114 87 121 108 78 87 87 255 255 103 101 105 102 73 91 78 72 93 115 88 89 82 81 255 255 71 95 86 95 80 64 50 83 114 110 69 83 62 60 255 255 122 53 73 110 129 149 124 132 135 97 66 64 44 87 255 235 83 90 34 59 90 95 81 85 83 52 45 40 52 75
16x16 pixels
Digital
The format of a matrix of integers (previous page) is the lowest level format. In practice, images are never written as integers. They are always in binary formats, or ASCII code [PGM P5 (raw), gif, jpeg, jpeg2000, png,...]
Example: same image in ASCII code format (raw): P5 # subject03.wink_16x16_P5.pgm 16 16 255 Iy~J|>K%^Yy~RJ@LX~@~]~Hhlm`]N/~IJZz@J~Yi)^[^V,L]U~Gr'^Q^X!E~W&5v~P~Hog~X~EUC@] {~Gt_C=Sew~W~\~_~E~I~J~R{r~V~U~O~~KrZ~ \u~K~C~Xgz~V~X~B9}~L~Dn~D}p~A~Ep~J~SGNQ5A[o~]tp~C~L}0'^_:kY EC_hyyz`ei4<I@^^VoWdymd7^_ %LYrWylNWWgeifI[NH]sXYRQG_V_P@2SrnES><z5In~A~U| ~D~GaB@,WSZ";Z_QUS4-(4K integers (P2): 1095 characters ASCII (P5): 313 characters Further reduction of size can be made using Huffman coding method, or variations on that theme. Many of these encoding methods constitute a U.S. patent (e.g., jpeg2000 cannot be read, by law (under dispute), on Microsoft Windows operating systems).
Digital
Example: (see Van Fleet page 90) P2 # example.pgm 126 55 33 80 80 80 33 80 56 104 56 80 56 80 126 80 56 80 56 104 56 80 33 80 80 80 33 Find relative frequencies of each intensity (e.g. 12 times 80, etc) Re-order all intensities according to their relative frequency Frequencies can be seen as probabilities of occurences Create tree of probabilities from the less frequent to the most frequent Read the graph for each intensities Transform integer intensity in ASCII code, then binary
1 0 0.48 0
1 0.52 1
126 1/25=0.04 0.28 0.24 104 2/25=0.08 33 4/25=0.16 0 1 56 6/25=0.24 0.12 0.16 80 12/25=0.48 0 1 Character 126 (binary=01111110) 0.04 0.08 using Huffman code is replaced by 1100 after following the path of the graph starting at probability 1 on top This algorithm requires a stream of 48 bits, instead of 200 when put one after another
Digital
0.04
0.08
0.16
0.24
0.48
Digital
0.04 + 0.08
0.16
0.24
0.48
Digital
0.24
0.48
Digital
0.48
Digital
0.52
0.48
Digital
0.48
0.52
Digital
1.00
0.48
0.52
Digital
Digital
Digital
Integer matrix P2 # example.pgm 126 55 33 80 80 80 33 80 56 104 56 80 56 80 126 80 56 80 56 104 56 80 33 80 80 80 33 Bit stream is about 6 times longer
Compressed format 1.00 0 0.48 0 0.24 0 0.12 0 0.04 1 0.08 1 0.52 1 0.28 1 0.16
(Frequencies are put in binary format) Bit stream:111000111010110110010011000100101101100111000111 Images are represented in that format, using variations of Huffman encoding. Softwares such as xv rebuild the Huffman scheme from the compressed format.
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Reminder
From last talk, we found the general conditions on scaling + wavelet functions: Wavelets and Multiwavelets, by Fritz Keinert
Reminder
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Discrete
Example: signal of 16 elements with Daubechies of order L+1 = 2, 4, and 6 P2 # subject02.wink_16x16.pgm 16 16 255 73 121 183 206 192 180 204 211 213 164 138 124 62 75 37 25 121 146 74 64 76 88 128 157 136 104 108 109 96 93 78 47 137 74 90 122 64 45 74 153 105 41 27 22 44 76 93 85 135 114 39 17 24 33 69 237 151 38 53 118 144 136 111 103 152 133 85 67 64 93 123 245 135 116 95 67 61 83 101 119 151 156 165 175 159 170 133 255 137 138 146 161 199 161 123 114 150 149 183 210 182 143 126 229 139 114 90 213 199 190 156 117 139 131 152 168 164 103 122 206 150 152 130 57 125 140 132 110 132 125 112 129 133 112 138 164 147 71 78 81 53 65 91 111 157 116 112 131 140 125 48 39 31 58 107 89 69 67 95 104 255 121 121 122 96 101 105 52 60 73 64 30 86 111 87 100 255 121 109 100 55 31 37 76 89 114 87 121 108 78 87 87 255 255 103 101 105 102 73 91 78 72 93 115 88 89 82 81 255 255 71 95 86 95 80 64 50 83 114 110 69 83 62 60 255 255 122 53 73 110 129 149 124 132 135 97 66 64 44 87 255 235 83 90 34 59 90 95 81 85 83 52 45 40 52 75 255= white 0= black
16x16 pixels
Each column is an independent signal. Here 16 signals of length 16. We consider only that signal
Discrete
But first: concept of downsampling. Example with Haar (Daubechies-02) Haar is easy: H=Low filter: (x+y)/2 G=High filter: (x-y)/2
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Harr,
Harr,
Harr,
Harr,
Harr,
where:
Harr,
Length of signal Wrapping rows appear, in general: treated in the algorithm below
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Harr,
1 wrapping row
1 wrapping row
Condition of orthogonality:
T T
Harr,
HH
(1 equation)
HG :
(1 equation)
Condition
gives
(4 equations)
We have 6 equations for 8 unknowns; 2 more equations are needed. For this we use the theorem on the basic regularity conditions concerning the symbols:
where
One can show that the first equation h(0) = 1 is redundant when h is orthogonal. The second condition gives: (1 equation) Still one equation missing...
Harr,
An additional equation is obtained by setting the first derivative of the symbols This gives: Solution: to zero.
For the high pass filter: One can show that the solution is unique (e.g., Van Fleet page 233, or Daubechies article).
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Harr,
2 wrapping rows
2 wrapping rows
Same procedure, but now will also need the first and the second derivative of symbols.
Harr,
System of equations:
orthogonality
symbol 1st derivative of symbol 2nd derivative of symbol System is non-linear; there exist 2 solutions. One is:
and examples Essential tools of xv software for image translations and dimensioning Digital image formats (and Huffman algorithm): image=multidimensional signals Reminder of the essential ingredients of the wavelets theory (Haar- Daubechies) Discrete wavelet transformation in terms of matrices for 1-D (vector) signal Harr, Daubechies-04, Daubechies-06, ..., Daubechies-{L+1}
Day 2
February 5, 2009
Structure
of algorithm for 1-D Daubechies transformation and inverse Algorithm for 2-D (matrix) Daubechies transformation and inverse Parallelization Compression; Edge detection Program: implementation, structure, example runs Day 3 February 19, 2009
Applications
of wavelet theory to operators Density matrix and wavelets applied to Density functional Theory or Eigenvalue problems Multiwavelets: Legendre, Tchebychev
Harr,
Harr,
There exist solutions to this system (theorem). In practice, only one solution has all the roots of a certain polynomial outside a sphere of radius 1 in the complex plane. (example how to solve shown last time in talk#2). That solution is the Daubechies wavelet. (Details are in Daubechies seminal article,or in Van Fleet page 259) L+1= #of solutions 2 1 4 2 6 2 8 4 10 4 12 6 14 ... 6 ...
Harr,
PROGRAM: Coefficients are stored in Coefficients.h (include Coefficients.h;) const double Daub01[2] = { 7.071067811865475244008443621048490392848359376884740365883398e-01, 7.071067811865475244008443621048490392848359376884740365883398e-01}; const double Daub02[4] = { 4.829629131445341433748715998644486838169524195042022752011715e-01, 8.365163037378079055752937809168732034593703883484392934953414e-01, 2.241438680420133810259727622404003554678835181842717613871683e-01, -1.294095225512603811744494188120241641745344506599652569070016e-01};
...
const double Daub38[76] = { 1.425776641674131672055420247567865803211784397464191115245081e-06, 3.576251994264023012742569014888876217958307227940126418281357e-05, 4.211702664727116432247014444906469155300573201130549739553848e-04, 3.083088119253751774288740090262741910177322520624582862578292e-03,
...
2.045099676788988907802272564402310095398641092819367167252952e-15, -4.405307042483461342449027139838301611006835285455050155842865e-16, 4.304596839558790016251867477122791508849697688058169053134463e-17, -1.716152451088744188732404281737964277713026087224248235541071e-18};