使用 Daubechies 滤波器进行子带分解
我有以下两个 8 抽头滤波器:
h0 ['-0.010597', '0.032883', '0.030841', '-0.187035', '-0.027984', '0.630881', '0.714847', '0.230378']
h1 ['-0.230378', '0.714847', '-0.630881', '-0.027984', '0.187035', '0.030841', '-0.032883', '-0.010597']
它们位于图表上:
我用它来获取近似(图像的下子带)。这是下图中的 a(m,n)
:
我得到了系数并且书中的图表数字图像处理,第三版,所以我相信他们是正确的。 星符号表示一维卷积(行或列)。向下箭头表示一个维度(在行或列上)进行下采样。
我的问题是 h0
和 h1
的滤波器系数之和大于 1(准确地说约为 1.4 或 sqrt(2))。当然,如果我将任何图像与滤镜进行卷积,图像会变得更亮。事实上,这就是我得到的结果(右侧的预期结果):
有人可以建议这里的问题是什么吗?如果卷积滤波器系数之和大于 1,为什么它会起作用?
我有源代码,但它很长,所以我希望避免将其发布在这里。如果确实有必要的话,我稍后会提出来。
编辑
我正在做的是:
- 分解为子带
- 过滤子带之一
- 重新组合子带为原始图像
请注意,重点不仅仅是有一个可显示的子带分解图像——我还必须能够从子带完美地重建原始图像。因此,如果我缩放滤波后的图像以补偿分解滤波器使图像更亮,这就是我必须要做的:
- 分解为子带
- 将强度缩放应用于近似子带
- 过滤子带之一
- 对近似子带应用逆强度缩放
- 将子带重新组合成原始图像
步骤 2 执行缩放。这就是@Benjamin 的建议。问题是步骤 4 就变得必要了,否则原始图像将无法正确重建。这个较长的方法将会起作用。然而,教科书明确表示不对近似子带进行缩放。当然,也有可能课本有错。然而,更可能的是我误解了这一切的运作方式——这就是我问这个问题的原因。
编辑(2010/7/8)
我写信给这本书的作者确认。他说,不管书中是怎么说的,你确实必须执行缩放。
I have the following two 8-tap filters:
h0 ['-0.010597', '0.032883', '0.030841', '-0.187035', '-0.027984', '0.630881', '0.714847', '0.230378']
h1 ['-0.230378', '0.714847', '-0.630881', '-0.027984', '0.187035', '0.030841', '-0.032883', '-0.010597']
Here they are on a graph:
I'm using it to obtain the approximation (lower subband of an image). This is a(m,n)
in the following diagram:
I got the coefficients and diagram from the book Digital Image Processing, 3rd Edition, so I trust that they are correct. The star symbol denotes one dimensional convolution (either over rows or over columns). The down arrow denotes downsampling in one dimension (either over rows, or columns).
My problem is that the filter coefficients for h0
and h1
sum to greater than 1 (approximately 1.4 or sqrt(2) to be exact). Naturally, if I convolve any image with the filter, the image will get brighter. Indeed, here's what I get (expected result on right):
Can somebody suggest what the problem is here? Why should it work if the convolution filter coefficients sum to greater than 1?
I have the source code, but it's quite long so I'm hoping to avoid posting it here. If it's absolutely necessary, I'll put it up later.
EDIT
What I'm doing is:
- Decompose into subbands
- Filter one of the subbands
- Recompose subbands into original image
Note that the point isn't just to have a displayable subband-decomposed image -- I have to be able to perfectly reconstruct the original image from the subbands as well. So if I scale the filtered image in order to compensate for my decomposition filter making the image brighter, this is what I will have to do:
- Decompose into subbands
- Apply intensity scaling to approximation subband
- Filter one of the subbands
- Apply inverse intensity scaling to approximation subband
- Recompose subbands into original image
Step 2 performs the scaling. This is what @Benjamin is suggesting. The problem is that then step 4 becomes necessary, or the original image will not be properly reconstructed. This longer method will work. However, the textbook explicitly says that no scaling is performed on the approximation subband. Of course, it's possible that the textbook is wrong. However, what's more possible is I'm misunderstanding something about the way this all works -- this is why I'm asking this question.
EDIT (2010/7/8)
I wrote to the author of the book for a confirmation. He said that you do have to perform the scaling, despite of what is being said in the book.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你知道内核的和,为什么不通过除以正确的因子来校正卷积后的亮度呢?
(例如,您可以使用内核
[1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/ 取 3x3 平均值9]
,也可使用[2, 2, 2, 2, 2, 2, 2, 2, 2]
,然后将结果值除以18
...)编辑:正如我的评论中所述,h1 之和为 0。看来 h0 和 h1 彼此相反/相反,因此某些 h0 系数可能有错误的符号。
EDIT2:请阅读评论。我知道这篇文章没有回答这个问题,我将其留在这里供评论。
If you know the sum of the kernel, why not correct the brightness after convolution by dividing by the correct factor?
(For example you can take a 3x3 average with the kernel
[1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9]
, but also with[2, 2, 2, 2, 2, 2, 2, 2, 2]
then divide the resulting values by18
...)EDIT: As stated in my comment, h1 sums to 0. It appears that h0 and h1 are reversed / inverse of each other, so some of the h0 coefficients may have the wrong sign.
EDIT2: Please read comments. I know this post does not answer the question, I am leaving it here for the comments.