我需要做一个这样的数组:
array = [(image),(1,ll),(1,lh),(1,hl),(2,ll),(2,lh),(2,hl)]
在这里,图像是一个二维数组,其余的数组项是通过非抽取离散小波变换得到的分量,这些分量也是二维数组。在
例如
^{pr2}$在Python2.7中,这相当简单。在
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
然而,我无法在Matlab中做到这一点。在
udwt = ndwt2(image,2,'haar');
组件将位于udwt.dec
(udwt
结构的dec
字段)中,来自1 to 7
。在
从Python代码创建并行:
Python Matlab
udwt[0][0] My 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 from level 1 to level n.
Matlab's function gives components from level n to level 1.(reverse order))
问题是,我在Matlab(1,ll)中没有得到第一级的低-低分量(近似分量)。在
在使用ndwt2
进行2层分解时,它只给出了一个近似值和每个层(lh、hl、hh)的3个细节。在
而在Python的pywt.swt2()中,我得到了每个级别的近似值,以及每个级别的3个细节(lh、hl、hh)。在
那么我在Matlab中哪里可以找到这个1,ll呢?在
我认为udwt.dec{1}
是2,ll(根据答案here,第二级的低-低,而不是第一级。在
dec{ 1 } approximation level n
我应该使用其他函数而不是ndwt2
?在
目前没有回答
相关问题 更多 >
编程相关推荐