Undecimated discrete wavelet transform using Matlab and Python -
loosely based on above figure:
i need make array this:
array = [(image),(1,ll),(1,lh),(1,hl),(2,ll),(2,lh),(2,hl)]
here, image numpy 2d array, , rest other array items components obtained undecimated discrete wavelet transform, 2d arrays.
for eg,
(1,ll) level 1 component,channel low-high (2,hl) level 2 component, channel high-low
with python 2.7, simple.
udwt = np.asarray(pywt.swt2(image, 'haar',2)) array = [image, udwt[0][0] , #1,ll udwt[0][1][0], #1,lh udwt[0][1][1], #1,hl udwt[1][0] , #2,ll udwt[1][1][0], #2,lh udwt[1][1][1]] #2,hl
however, unable in matlab.
udwt = ndwt2(image,2,'haar');
components found in udwt.dec
(dec
field of udwt
structure), 1 7
.
creating parallels python code:
python matlab udwt[0][0] question udwt[0][1][0] udwt.dec{5} udwt[0][1][1] udwt.dec{6} udwt[1][0] udwt.dec{1} udwt[1][1][0] udwt.dec{2} udwt[1][1][1] udwt.dec{3} (python's function gives components level 1 level n. matlab's function gives components level n level 1.(reverse order))
the problem is, not getting low-low component (approximation component)of 1st level in matlab (1,ll).
on using ndwt2
2 level decomposition, gives me 1 approximation , 3 details each level (lh,hl,hh).
whereas in python's pywt.swt2(), approximation each level, , 3 details(lh,hl,hh) each level.
so find 1,ll in matlab?
i consider udwt.dec{1}
2,ll (low-low of 2nd level instead of 1st level based on answer here.
dec{ 1 } approximation level n
shall using other function instead of ndwt2
?
Comments
Post a Comment