离散小波变换的法律5/3起重(负值,可视化,LH HL混乱) [英] Discrete Wavelet Transform LeGal 5/3 with Lifting (negative values, visualizing, LH HL confusion)

查看:242
本文介绍了离散小波变换的法律5/3起重(负值,可视化,LH HL混乱)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前潜入小波,是一个有点困惑某些事情。

I am currently diving into Wavelets and are a bit confused about certain things.

首先,这不是功课。其休闲编码只。

First of all, this is NOT homework. Its for recreational coding only.

为了更好地理解,我实现了提升,计划在C.法律5/3小波
据我所看到的,它似乎工作。我可以扭转和原始图像被正确地再现。
在伪code,我期待载重吨看起来是这样的:

In order to gain a better understanding, I implemented the lifting-scheme for the LeGal 5/3 wavelet in C. As far as I can see, it seems to work. I can reverse it and the original images is reproduced correctly. In pseudo-code, my forward dwt looks like this:

// deinterleave splits the low band from the high band 
// (e.g. 1 0 3 0 6 0 8 1 11 becomes 1 3 6 8 11 | 0 0 0 1)

for each row in image:
     dwt1d(row)
     deinterleave(row)
for each col in image:
     dwt1d(col)
     deinterleave(col)

不过,我有几件事情作斗争。

But I struggle with a couple of things.


  1. 在应用载重吨,我找回我的转换后的图像,但值是超出范围[0 - 255]。因此,我将它们存储在短裤。有些是负面的,有些是非常大的。现在,我怎么才能显示他们得到很好的那些精美的影像,如下所示:(<一href=\"http://www.whydomath.org/node/wavlets/images/Largetoplevelwt.gif\">http://www.whydomath.org/node/wavlets/images/Largetoplevelwt.gif)?如果我告诉我在Matlab图像是 imshow(图像,[]),然后我的输出看起来像这样: http://i.imgur.com/dNaYwEE.jpg 。所以,我必须做我的子带了一些转变?如果是的话,可以有人点我一个解决方案,或者告诉我该怎么办?

  1. When applying the dwt, I get back my transformed image, but the values are out of range [0 - 255]. Therefore I store them in shorts. Some are negative, and some are very large. Now how can I display them in order to get those nicely looking images as shown here: (http://www.whydomath.org/node/wavlets/images/Largetoplevelwt.gif)? If I show my image in Matlab with imshow(image, []), then my output looks like this: http://i.imgur.com/dNaYwEE.jpg. So, do I have to do some transformation on my sub bands? If yes, can someone point me to a solution or tell me what to do?

在文献中,我有时看到的子带排序是这样的:
[LL LH; HL HH]有时候是这样的:[LL HL; ] LH HH。后者,我看主要是当纸张约JPEG2000,也就是我的算法产生。在Matlab然而,使用lwt2函数时,则返回前者的布局。我也看到这个的时候我比较我的输出从MATLAB输出。它似乎LH和HL混合起来。怎么可能?有关系吗?是否有做用起重代替卷积的东西吗?

In the literature, I see sometimes that the sub bands are ordered like this: [ LL LH; HL HH ] and sometimes like this: [ LL HL; LH HH ]. The latter, I see mostly when the paper is about JPEG2000 and is also what my algorithm produces. In Matlab however, when using the lwt2 function, it returns the former layout. I see this also when I compare my output with the output from Matlab. It seems as LH and HL are mixed up. How can that be? Does it matter? Does it have to do something with using lifting instead of convolution?

是否实际上很重要,如果一个先列,反之亦然行呢?我看到我的输出没有区别,当我切换顺序。这将是唯一不同的是,LH变得HL和HL变得LH。然而,因为输出是一样的,不解决我的第二个问题。它只是符号上我猜。所以,有什么关系?我看到报纸,他们做的山坳行等在那里做行山坳。双方就JPEG2000。

Does it actually matter if one does rows first and then columns or visa versa? I see no difference in my output when I switch the order. The only thing that would be different is that LH becomes HL and HL becomes LH. However, that doesn't resolve my second question because the output is the same. Its just notational I guess. So does it matter? I saw papers where they do col-row and others where they do row-col. Both with respect to JPEG2000.

非常感谢。如果有人能在我的问题提供一些线索,然后我会非常感激。

Thanks a lot. If someone could shed some light on my issues then I'd be very grateful.

亲切的问候,
马库斯

Kind Regards, Markus

推荐答案

我写了一篇博客有关构建WDR图像融为一体pression系统。你可以在这里阅读更多:

I wrote a blog about building a WDR image compression system. You can read more here:

http://trueharmoniccolours.co.uk/Blog/

(你会注意到,我不是一个多产的博客;))。它应该包含所有你需要实现自己的C ++版本WDR图像融为一体pression的。如果不是随意解雇我留言,问!

(You'll note that I'm not a very prolific blogger ;) ). It should contain all you need to implement your own C++ version of WDR image compression. If not feel free to fire me a message and ask!


  1. 是的,这确实是一个下从我听出记录的功能。从DWT返回的值实际上是一个短期和要求范围-255到+255。现在当然-255使用8位的颜色,当不直接渲染。因此人们通常做的是除以2的值,并添加128显示(不要忘记显示器只是用于调试的工具)。移动0这种方式是128,因此一个中灰一个灰度图像。

  1. Yes this is a really under documented "feature" from what I could work out. The value returned from the DWT is actually a short and requires the range -255 to +255. Now of course -255 is not directly renderable when using 8-bit colour. As such what people usually do is divide the value by 2 and add 128 for display (Don't forget display is just a tool for debugging). This way you move 0 to be a 128 and hence a "mid grey" on a greyscale image.

它并不真正的问题提供你反变换你正变换的方法相同。

It doesn't really matter provided you do the inverse transform the same way you do the forward transform.

没有,应该没有什么区别。当实现你决定在何处写入目标像素所以你可以自由你喜欢的地方(到例如一个完全不同的形象)来写它。

No it should make no difference. When implementing you decide where to write the destination pixel so you are free to write it where you like (to a completely different image for example).

修改:对于您的评论的涂抹5/3升降公式如下:

Edit: Regarding your comment the Daub 5/3 lifting equation is as follows:

d = s[n + 1] - ((s[n + 0] + s[n + 2]) / 2);

所以在源图像的情况下, 255,0,255 ...这将导致广告 -255 。与 0,255,0 将给予最大的 255 ,所以你一定要在范围<$ C起$ C> -255到+255 或有什么不对您的实现。

So in the case of a source image of 255, 0, 255 ... that would result in a d of -255. Starting with 0, 255, 0 would give the maximum of 255 so you should definitely be in the range -255 to +255 or there is something wrong with your implementation.

这篇关于离散小波变换的法律5/3起重(负值,可视化,LH HL混乱)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆