wave_transform.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:semantic-segmentation 作者: albertbuchard 项目源码 文件源码
def iuwt(wave, convol2d =0):
    mode = 'nearest'

    lvl,n1,n2 = np.shape(wave)
    h = np.array([1./16, 1./4, 3./8, 1./4, 1./16])
    n = np.size(h)

    cJ = np.copy(wave[lvl-1,:,:])


    for i in np.linspace(1,lvl-1,lvl-1):

        newh = np.zeros((1,n+(n-1)*(2**(lvl-1-i)-1)))
        newh[0,np.int_(np.linspace(0,np.size(newh)-1,len(h)))] = h
        H = np.dot(newh.T,newh)

        ###### Line convolution
        if convol2d == 1:
            cnew = cp.convolve2d(cJ, H, mode='same', boundary='symm')
        else:
          cnew = sc.convolve1d(cJ,newh[0,:],axis = 0, mode = mode)
            ###### Column convolution
          cnew = sc.convolve1d(cnew,newh[0,:],axis = 1, mode = mode)

        cJ = cnew+wave[lvl-1-i,:,:]

    return np.reshape(cJ,(n1,n2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号