HAAR Function
Performs a Haar transform on a square image. If the input image is not square, it is padded with zeros to make it square before the transform is performed. Images whose dimensions are not a power of two are padded to have dimensions that are the nearest power of two.
Usage
result = HAAR(image[, direction])
Input Parameters
image—A 2D or 3D array containing an image; or image, row, or pixel-interleaved images.
direction—(optional) Specifies the direction of the transform.
*–1—Forward transform (default)
*1—Backward transform
Returned Value
result—A 2D or 3D square floating-point matrix, whose dimensions are N-by-N where N is the largest dimension of the input parameter image rounded to the nearest larger power of two.
Keywords
Intleave—A scalar string indicating the type of interleaving of 3D input image arrays. Valid strings and the corresponding interleaving methods are:
*'pixel'—The input array arrangement is (pxy) for p  pixel-interleaved images of x-by-y.
*'row'—The 3D image array arrangement is (xpy) for p  row-interleaved images of x-by-y.
*'image'—The 3D image array arrangement is (xyp) for p  image-interleaved images of x-by-y.
Discussion
The Haar transform uses the Haar basis functions, hk(z), which are defined in the interval z [0, 1], and for k = 0, 1, 2, ..., N – 1, where N is a power of 2. The following equations define the Haar functions:
where p is in the range 0 p n – 1; and q = 0 or 1 for p = 0; and
1 q 2p when p 0.
and
otherwise,
for z [0, 1].
A Haar matrix is formed from the elements of h(z), with the j-th row of the matrix formed from elements of hj(z) for z = 0/N, 1/N, 2/N, ..., (N – 1)/N.
For example, the 2-by-2 Haar matrix is:
The Haar transform is then applied as:
T = H*image*H
where H is the Haar matrix and T is the transform result.
Example
; Read an image.
image = IMAGE_READ(!IP_Data + 'airplane.tif')
; Compute the Haar transform.
haar_image = HAAR(image('pixels'))
; Display the transformed image.
TVSCL, IPALOG(haar_image)
See Also