|
Calling Sequence
|
|
DWT2D(img)
InverseDWT2D(coefficients)
|
|
Parameters
|
|
img
|
-
|
Image
|
coefficients
|
-
|
list
|
|
|
|
|
Options
|
|
•
|
bordermode : identical( repl, mirror, const, "repl", "mirror", "const" )
|
•
|
bordervalue : algebraic or list
|
•
|
output identical( listtriples, threelists, flat, default, "listtriples", "threelists", "flat", "default" )
|
|
|
Description
|
|
•
|
The DWT2D(img) command computes the Haar discrete wavelet transform of the image img. Where img can only be two dimensional or three dimensional. The low-pass decimation filter and the high-pass decimation filter used in this command are and .
|
•
|
The level option specifies the number of levels the wavelet transform should apply. At each level, discrete wavelet transform would be applied to Approximation. The default value is the maximum level. The maximum level can be specified as .
|
•
|
When the wavelet transform is applied for one level, the command returns four Arrays with datatype float[4], denoted by Approximation, HorizontalDetail, VerticalDetail and DiagonalDetail. They are obtained by convolving by low-pass filters and high-pass filters. The relevant convolution process are listed below.
|
Approximation
|
convolve by low-pass filter horizontally and low-pass filter vertically
|
HorizontalDetail
|
convolve by low-pass filter horizontally and high-pass filter vertically
|
VerticalDetail
|
convolve by high-pass filter horizontally and low-pass filter vertically
|
DiagonalDetail
|
convolve by high-pass filter horizontally and high-pass filer vertically
|
|
|
•
|
The bordermode and bordervalue options are used to specify the border extension mode. The bordervalue option can only be specified when the bordermode option is set to const. The bordervalue option can be anything that can be converted to a float or a list of three elements that can be converted to floats, if the img parameter is three dimensional. If only one value is provided when img is three dimensional, this value will be used at each layer. There are three border modes that can be specified: repl, mirror and const. Let A be . The resulting matrices of each border extension mode are shown below.
|
•
|
repl :
|
•
|
mirror : .
|
•
|
const with bordervalue = v : .
|
•
|
The border extension is also used when the number of rows or columns of img are odd. In this case, an extra row or column would be added to extend the img, so that it has even number of rows and columns. The way to extend the columns or rows are specified by bordermode and bordervalue.
|
•
|
If output is specified to listtriples, then the command would return . If output is specified to threelists, then the command would return . If output is specified to flat, then the command would return . The default value for output is default which sets output to flat if level is one and sets output to listtriples when level is more than one.
|
•
|
The InverseDWT2D(coefficients) computes the inverse Haar discrete wavelet transform. The low-pass decimation filter and the high-pass decimation filter used in this command are and . It returns the results in an Array with datatype float[4].
|
•
|
The InverseDWT2D(coefficients) is not a perfect inverse if the expected output has odd number of rows or columns. Then, the output array would contains the extra row or column that is added in the internal DWT2D procedure. The bordermode and bordervalue must be the same as the input when applying DWT2D. The number of maximum level it can be specified depends on coefficients. The default level is the maximum levels the inverse can apply with the given coefficients. There is no output option in the InverseDWT2D command, but coefficients can be in any form that DWT2D returns.
|
|
|
Examples
|
|
>
|
|
>
|
|
The Embed command needs its images to have datatype float[8]. The DWT2D command returns its results with datatype float[4].
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (5.2) |
|
|
Compatibility
|
|
•
|
The ImageTools[DWT2D] and ImageTools[InverseDWT2D] commands were introduced in Maple 2020.
|
|
|
|