def rec2d(a, d, wavelet, boundary, rec, level): d1, d2, d3 = d if a.shape != d1.shape: a = nputils.index(a, np.s_[:-1]) temp_a = rec(a, d1, wavelet, boundary, level, axis=1) temp_d = rec(d2, d3, wavelet, boundary, level, axis=1) img = rec(temp_a, temp_d, wavelet, boundary, level, axis=0) return img
def waverec2d(coefs, wavelet, boundary="symm", rec=dwt_inv, shape=None, thread=None): a = coefs[-1] for j in range(len(coefs) - 2, -1, -1): if thread and not thread.is_alive(): return None a = rec2d(a, coefs[j], wavelet, boundary, rec, j) if shape and shape != a.shape: a = nputils.index(a, np.s_[:-1]) return a
def waverec(coefs, wavelet, boundary="symm", rec=dwt_inv, axis=None, shape=None, thread=None): a = coefs[-1] for j in range(len(coefs) - 2, -1, -1): if thread and not thread.is_alive(): return None a = rec(a, coefs[j], wavelet, boundary, j, axis=axis) if shape and shape != a.shape: # See idwt() for an explaination a = nputils.index(a, np.s_[:-1], axis) return a