【发布时间】:2020-11-07 19:20:49
【问题描述】:
我有一些图像数据 - 据说 - 使用 MATLAB 的 5/3 Le Gall 整数提升小波变换进行了变换。执行逆 DWT 的实际 Matlab 代码调用以下函数:
liftwave('rbio2.2')
它将 4 个 128x128 矩阵(LL、HL、LH、HH)和小波(在提升方案中称为 LS)作为输入,并返回 252x252 像素的图像。我不知道它是否在进行逆 DWT 之前添加了任何填充,也不知道生成的图像大小对于这种类型的小波是否正常。
我正在寻找在 Matlab 之外实现特定小波逆 DWT。我尝试过 pywavelets,但生成的图像不同(错误)。
谁能推荐一个开源实现?
更新
我发现(其中之一)following implementation of the bior2.2 具有整数到整数映射的小波:
void dwt_cdf53_i_ex_stride_i(
const int *src_l,
const int *src_h,
int *dst,
int *tmp,
int N,
int stride)
{
assert( N >= 0 && NULL != src_l && NULL != src_h && NULL != dst && NULL != tmp && 0 != stride );
// fix for small N
if(N < 2)
return;
// copy src into tmp
dwt_util_memcpy_stride_i(tmp+0, 2*sizeof(int), src_l, stride, ceil_div2(N));
dwt_util_memcpy_stride_i(tmp+1, 2*sizeof(int), src_h, stride, floor_div2(N));
// backward update 1 + backward predict 1
for(int i=2; i<N-(N&1); i+=2)
tmp[i] -= ( (tmp[i-1] + tmp[i+1]) + 2 ) >> 2;
tmp[0] -= (tmp[1] + 1) >> 1;
if(is_odd(N))
tmp[N-1] -= (tmp[N-2] + 1) >> 1;
else
tmp[N-1] += tmp[N-2];
for(int i=1; i<N-2+(N&1); i+=2)
tmp[i] += ( tmp[i-1] + tmp[i+1] ) >> 1;
// copy tmp into dst
dwt_util_memcpy_stride_i(dst, stride, tmp, sizeof(int), N);
}
如何改变它来执行反向双正交小波?
【问题讨论】:
-
在 StackOverflow 上寻求书籍、工具、软件库等推荐的问题被视为 off-topic。此类问题可以在Software Recommendations SE 网站上回答。
-
@rahnema1 我已经改写了我的问题,要求修改特定代码 sn-p 以便它执行 rbio2.2 逆 DWT 而不是 bior2.2。
标签: c matlab wavelet wavelet-transform