Here is a sample code for applying a 1-degree wavelet transform to an image in MATLAB:
main.m678 chars28 lines
Explanation:
h
in this case, the Haar wavelet.h
with the image (conv2(h, h, img, 'valid')
). Then, extract the low-frequency and high-frequency components of the transformed image by selecting alternate rows and columns of the convolution result (C(1:2:end,1:2:end)
and C(1:2:end,2:2:end)
).Note that this 1-degree wavelet transform is the Haar wavelet transform, which is just one of many wavelet transforms available.
gistlibby LogSnag