我有一些图像数据,应该是用MATLAB的5/3 Le Gall整数提升小波变换来转换的。执行逆DWT的实际Matlab代码调用以下函数:
liftwave('rbio2.2')它以4个128x128矩阵(LL,HL,LH,HH)和小波(从提升格式中称为LS )作为输入,并返回252x252像素的图像。我不知道它在做逆DWT之前是否增加了任何填充,对于这种类型的小波,也不知道得到的图像大小是否正常。
我正在寻找一个实现特殊的小波逆DWT外Matlab。我试过了小波,但得到的图像是不同的(错误)。
有人能建议开放源码实现吗?
更新
我发现(众多的)整数到整数映射的“生物多样性公约”的实施情况小波:
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);
}如何改变这一点,以执行反向双正交小波?
发布于 2020-11-07 08:06:18
逆双正交样条小波(rbig2.2)与双正交小波(bior2.2)的正演变换是一致的。从头上看,反向小波整数到整数逆变换的代码应该如下所示:
void dwt_rcdf53_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));
// predict 1 + update 1
for(int i=1; i<N-2+(N&1); i+=2)
tmp[i] -= (tmp[i-1] + tmp[i+1]) >> 1;
if(is_odd(N))
tmp[N-1] += (tmp[N-2] + 1) >> 1;
else
tmp[N-1] -= tmp[N-2];
tmp[0] += (tmp[1] + 1) >> 1;
for(int i=2; i<N-(N&1); i+=2)
tmp[i] += ((tmp[i-1] + tmp[i+1]) + 2) >> 2;
// copy tmp into dst
dwt_util_memcpy_stride_i(dst, stride, tmp, sizeof(int), N);
}https://stackoverflow.com/questions/64688394
复制相似问题