Main Content

2-D Haar wavelet transform

`[`

performs the 2-D Haar discrete wavelet transform (DWT) of the matrix,
`a`

,`h`

,`v`

,`d`

]
= haart2(`x`

)`x`

. `x`

is a 2-D, 3-D, or 4-D matrix with
even length row and column dimensions. If `x`

is 4-D, the
dimensions are Spatial-by-Spatial-by-Channel-by-Batch. The Haar transform is always
computed along the row and column dimensions of the input. If the row and column
dimensions of `x`

are powers of two, the Haar transform is
obtained down to level `log2(min(size(x,[1 2])))`

. If the row or
column dimension of `x`

is even, but not a power of two, the Haar
transform is obtained down to level ```
floor(log2(min(size(x,[1
2])/2)))
```

.

`haart2`

returns the approximation coefficients,
`a`

, at the coarsest level. `haart2`

also
returns cell arrays of matrices containing the horizontal, vertical, and diagonal
detail coefficients by level. If the 2-D Haar transform is computed only at one
level coarser in resolution, then `h`

, `v`

,
and `d`

are matrices. The default `level`

depends on the number of rows of `x`

.