OPENCV基于DFT的Filter2D实际上是如何工作的?

发布于 2025-01-27 14:45:59 字数 364 浏览 2 评论 0 原文

我有问题理解 OpenCV库的方法实际上有效。根据文档,该功能使用基于DFT的算法的“标准”直接版本很明显,但是对于较大的内核大小”(〜11 x 11或更大)。

哪种基于DFT的算法?没有给出科学参考,我无法确定尤其是使用哪种算法。我知道DFT是如何工作的,因此我同时侦察,输入图像和内核被转换为频谱表示,在其中进行了卷积,然后再次返回?如果这是一般的想法,我仍然想要一些其他背景信息。

I have issues comprehending how the filter2D method of the the OpenCV library actually works. The "standard" direct version for small kernel sizes is clear, but for larger kernel sizes "(~11 x 11 or larger) the function uses the DFT-based algorithm", according to the documentation.

Which DFT-based algorithm? There is no scientific reference given and I wasn't able to determine which algorithm is used in particular. I am aware of how a DFT works, so I recon both, input image and kernel are transformed into a spectral representation where the convolution is conducted and then back again? If this is the general idea I would still like some additional background information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别闹i 2025-02-03 14:45:59

用于使用DFT处理卷积的技术通常称为“ “。当内核很大时,这是合适的,但仍然比您应用于的信号/图像小得多。

在2D中,给定MXM内核(通常为M将被舍入到2的功率):

  1. 将图像分为MXM块。
  2. 将块和内核用零填充到2MX2M大小。
  3. FFT卷积用于与内核进行卷积。每个卷积产生2MX2M的结果,但是由于输入的非零部分仅是MXM,因此卷积不会包裹。可以为所有块重复使用相同的内核FFT。
  4. 然后以重叠的方式将每个MXM块的2MX2M结果添加在一起,以产生结果图像。

该技术很长一段时间以来在信号处理字段中已知,而且我没有提及其来源。还有一种变体被称为“ reberlaplap-save ”。

Google搜索“ 2D重叠添加卷积”产生了令人满意的结果。

The technique used to process convolutions using the DFT is generally known as "overlap-add". It is appropriate when the kernel is large, but still quite a bit smaller than the signal/image that you're applying it to.

In 2D, given an MxM kernel (and usually M would be rounded up to a power of 2):

  1. The image is divided into MxM blocks.
  2. The blocks and the kernel are padded out with zeros to 2Mx2M size.
  3. FFT convolution is used to convolve each block with the kernel. Each convolution produces a 2Mx2M result, but because the non-zero parts of the inputs are only MxM, the convolution doesn't wrap around. The same kernel FFT can be reused for all blocks.
  4. The 2Mx2M results from each MxM block are then added back together in an overlapping fashion to produce the resulting image.

This technique has been generally known in the signal processing field for a long time, and I don't have a reference to its origin. There's also a variation known as "overlap-save".

A google search for "2d overlap add convolution" yields somewhat satisfying results.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文