wst2D(m, filter.number=10, family="DaubLeAsymm")
m
wst2D
computes the (packet-ordered) 2D non-decimated
discrete wavelet transform. Such a transform may be used in wavelet
shrinkage of images using the AvBasis.wst2D
function to perform an "average-basis" inverse. Such a transform was
used to denoise images in the paper by
Lang, Guo, Odegard, Burrus and Wells, 1995.
The algorithm works by mixing the HH, GH, HG and GG image operators of the 2D (decimated) discrete wavelet transform (see Mallat, 1989 and the implementation in WaveThresh called imwd) with the shift operator S (as documented in Nason and Silverman, 1995) to form new operators (as given in the help to getpacket.wst2D).
Subimages can be obtained and replaced using the getpacket.wst2D and putpacket.wst2D functions.
This function is a 2D analogue of the (packet-ordered) non-decimated discrete wavelet transform implemented in WaveThresh as wst.
#
# We shall use the ua
image of
# the University coat of arms.
#
image(ua)
#
# Now let's apply the (packet-ordered) 2D non-decimated DWT to it...
# (using the default wavelets)
#
uawst2D <- wst2D(ua)
#
# One can use the function plot.wst2D to get
# a picture of all the resolution levels. However, let's just look at them
# one at a time.
#
# How many levels does our uawst2D object have?
#
nlevels(uawst2D)
#[1] 8
#
# O.k. Let's look at resolution level 7
#
image(uawst2D$wst2D[8,,])
#
# There are four main blocks here (each of 256x256 pixels) which themselves
# contain four sub-blocks. The primary blocks correspond to the no shift,
# horizontal shift, vertical shift and "horizontal and vertical" shifts
# generated by the shift S operator. Within each of the 256x256 blocks
# we have the "usual" Mallat smooth, horizontal, vertical and diagonal
# detail, with the smooth in the top left of each block.
#
# Let's extract the smooth, with no shifts at level 7 and display it
#
image(getpacket(uawst2D, level=7, index=0, type="S"))
#
# Now if we go two more resolution levels deeper we have now 64x64 blocks
# which contain 32x32 subblocks corresponding to the smooth, horizontal,
# vertical and diagonal detail.
#
immagic(uawst2D$wst2D[6,,])
#
# Groovy eh?