Project 04

Project 4

Problem 1 (15 points)

Let' s import a picture :

SetDirectory[NotebookDirectory[]];<<DW.wl

pic=ImageData[,"Byte"];
ImagePlot[pic,Scaled->True]

In Notebook  0631 the following module from 'DW.wl' (with a different name) is used to apply the Haar Transform ' n' times to a matrix ' pic' :

HaarWLTransform[pic_, n_] := 
 Module[{pc = pic, r = Dimensions[pic][[1]], c = Dimensions[pic][[2]]},
  	Do[ pc[[1 ;; r/2^k, 1 ;; c/2^k]] =Haar[r/2^k].pc[[1 ;; r/2^k, 1 ;; c/2^k]].Transpose[Haar[c/2^k]], {k, 0, n - 1,1}]; 
  	Return[pc];]

pic2=HaarWLTransform[pic,3];
ImagePlot[pic2,Scaled->False]

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 space (Subscript[V, 4 ]) defined in the handout Multi-Resolution Analysis for the Haar Wavelet. Your result should look like Fig. 6 in the handout.

Here is the definition of the father wavelet , its plot, and the plot of one of the elements in (Subscript[V, 4]):

phi[x_]=Piecewise[{{1,0<=x<1}},0]

Plot[phi[x],{x,-1,2},PlotStyle->{Blue,Thick},Exclusions->{0,1}]

Plot[1 4phi[16x]+1/4 4 phi[16x-7]+1/3 4 phi[16x-12]+1/2 4 phi[16x-13],{x,0,1},PlotStyle->{Blue,Thick},Exclusions->Table[k/16,{k,0,15}]]

Here is an example how to graph two functions simultaneously :

Plot[{Sqrt[x],x^2},{x,0,1},PlotStyle->{{Blue,Dashed},{Red,Thick}}]