Obtain the 2-D Haar transform of an image limiting the transform to 2 levels.
Load and view the image of a cameraman.
im = imread('cameraman.tif');
imagesc(im)
Obtain the 2-D Haar transform using the default maximum number of levels.
[a,h,v,d] = haart2(im);
Reconstruct the image using the inverse 2-D Haar transform and view the image. Notice the near-perfect reconstruction.
xrec = ihaart2(a,h,v,d);
imagesc(xrec)
Reconstruct and view the image using the inverse 2-D Haar transform, limited to level 2. Level 2 corresponds to the fourth scale because scale is defined as 2j, where j is the level.
xrec1 = ihaart2(a,h,v,d,2);
imagesc(xrec1)
Using fewer levels returns the average of the original image at level 2.